Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split Bind and basic consume functions #13

Merged
merged 5 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# rabbitmq-c Release Notes

## 0.0.1-dev - 2023-12-12
## 0.0.1-dev - 2024-05-06

### Features

Expand Down
18 changes: 17 additions & 1 deletion labview/labview_rabbitmq.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,22 @@ int lv_amqp_bind_queue(int64_t conn_intptr, uint16_t channel, char *exchange, ch

amqp_queue_bind(conn, channel, amqp_cstring_bytes(queuename), amqp_cstring_bytes(exchange), amqp_cstring_bytes(bindingkey), amqp_empty_table);
status = lv_report_amqp_error(amqp_get_rpc_reply(conn), "Binding queue", errorDescription);
return status;
}

LABVIEW_PUBLIC_FUNCTION
int lv_amqp_basic_consume(int64_t conn_intptr, uint16_t channel, char *queuename, LStrHandle errorDescription)
{
amqp_connection_state_t conn = (amqp_connection_state_t) conn_intptr;
int status;

// First check if the queue exists
amqp_boolean_t PASSIVE = 1;
amqp_boolean_t DURABLE = 0;
amqp_boolean_t EXCLUSIVE = 0;
amqp_boolean_t AUTO_DELETE = 1;
amqp_queue_declare_ok_t *r = amqp_queue_declare(conn, channel, amqp_cstring_bytes(queuename), PASSIVE, DURABLE, EXCLUSIVE, AUTO_DELETE, amqp_empty_table);
status = lv_report_amqp_error(amqp_get_rpc_reply(conn), "Checking queue", errorDescription);
if (status != 1)
{
return status;
Expand Down Expand Up @@ -177,7 +193,7 @@ int lv_amqp_consume_message(int64_t conn_intptr, int timeout_sec, LStrHandle out
amqp_rpc_reply_t res;
amqp_envelope_t envelope;

//amqp_maybe_release_buffers(conn);
amqp_maybe_release_buffers(conn);

status = lv_report_amqp_error(amqp_consume_message(conn, &envelope, &tval, 0), "Consuming message", errorDescription);
if (status != 1)
Expand Down
2 changes: 2 additions & 0 deletions labview/labview_rabbitmq.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ int lv_amqp_basic_publish(int64_t conn_intptr, uint16_t channel, char *exchange,

int lv_amqp_create_queue(int64_t conn_intptr, uint16_t channel, char* queue_name_in, LStrHandle queue_name_out, uint8_t passive, LStrHandle errorDescription);

int lv_amqp_basic_consume(int64_t conn_intptr, uint16_t channel, char *queuename, LStrHandle errorDescription);

int lv_amqp_bind_queue(int64_t conn_intptr, uint16_t channel, char *exchange, char *queuename, char *bindingkey, LStrHandle error_description);

int lv_amqp_consume_message(int64_t conn_intptr, int timeout_sec, LStrHandle output, LStrHandle cheaders, LStrHandle error_description);
Expand Down