Hello, I am trying to load a message with amqp types but am unsure on how
to pack and unpack.
If some one could point me towards the right direction I'd appreciate it.

I have tried the following (messenger and message setup omitted):
Note: I can send text without issue.

server:
int i=0;
pn_data_t *body = pn_message_body(message);
pn_data_fill(body, "si", "test", i);
pn_messenger_put(messenger, message);
pn_messenger_send(messenger);

client:
int i=0;
pn_messenger_recv(messenger, 1);
pn_messenger_get(messenger, message);
pn_data_t *body = pn_message_body(message);
pn_data_scan(body, "si", buff, &i);
printf("str:'%s', i:%d\n", buff, i);

output: "str:'', i:0"
...
I also tried:
server:
int i=0;
pn_data_t *pdata = pn_data(16);
pn_data_fill(pdata, "si", "test", i);
char buff[16];
size_t size = pn_data_encode(pdata, buff, 16);
pn_message_load_amqp(message, buff, size)
pn_messenger_put(messenger, message);
pn_messenger_send(messenger);
...
client:
char buff[16];
char sbuff[16];
int i=0;
pn_messenger_recv(messenger, 1);
pn_messenger_get(messenger, message);
pn_message_save_amqp(message, buff, size);
pn_data_t *pdata = pn_data(16);
size_t size = pn_data_decode(pdata, buff, 16);
pn_data_scan(pdata, "si", sbuff, i);
printf("str:'%s', i:%d\n", sbuff, i);

-Raul Jimenez

Reply via email to