MCPcopy Create free account
hub / github.com/apache/qpid-proton / send_message

Function send_message

c/examples/send.c:59–74  ·  view source on GitHub ↗

Create a message with a map { "sequence" : number } encode it and return the encoded buffer. */

Source from the content-addressed store, hash-verified

57
58/* Create a message with a map { "sequence" : number } encode it and return the encoded buffer. */
59static void send_message(app_data_t* app, pn_link_t *sender) {
60 /* Construct a message with the map { "sequence": app.sent } */
61 pn_data_t* body;
62 pn_message_clear(app->message);
63 body = pn_message_body(app->message);
64 pn_message_set_id(app->message, (pn_atom_t){.type=PN_ULONG, .u.as_ulong=app->sent});
65 pn_data_put_map(body);
66 pn_data_enter(body);
67 pn_data_put_string(body, pn_bytes(sizeof("sequence")-1, "sequence"));
68 pn_data_put_int(body, app->sent); /* The sequence number */
69 pn_data_exit(body);
70 if (pn_message_send(app->message, sender, &app->message_buffer) < 0) {
71 fprintf(stderr, "error sending message: %s\n", pn_error_text(pn_message_error(app->message)));
72 exit(1);
73 }
74}
75
76/* Returns true to continue, false if finished */
77static bool handle(app_data_t* app, pn_event_t* event) {

Callers 1

handleFunction · 0.70

Calls 13

pn_message_clearFunction · 0.85
pn_message_bodyFunction · 0.85
pn_data_put_mapFunction · 0.85
pn_data_enterFunction · 0.85
pn_data_put_intFunction · 0.85
pn_data_exitFunction · 0.85
pn_message_sendFunction · 0.85
pn_message_errorFunction · 0.85
exitFunction · 0.85
pn_message_set_idFunction · 0.50
pn_data_put_stringFunction · 0.50
pn_bytesFunction · 0.50

Tested by

no test coverage detected