activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: libstomp C message being read without me reading it
Date Tue, 11 Jun 2013 19:05:30 GMT
On 06/11/2013 02:53 PM, Sean Beck wrote:
> I am using the C library libstomp to send a message to my broker. It sends
> my message, but it also dequeues my message. I don't want it to do that.
>
> I have removed my error checking to decrease verbosity.
>
> Here is my setup for the connection:
>
> apr_status_t rc;
>
> rc = stomp_connect(&connection, "127.0.0.1", 61613, p);
>
> // connect frame
> frame.command = "CONNECT";
> frame.headers = NULL;
> frame.body = NULL;
> rc = stomp_write(connection, &frame, p);
>
> // now subscribe
> frame.command = "SUB";
> frame.headers = apr_hash_make(p);
> apr_hash_set(frame.headers, "destination", APR_HASH_KEY_STRING,
> "queuename");
> rc = stomp_write(connection, &frame, p);
>
> Here is my message sending:
>
> frame.command = "SEND";
> // no need to setup headers for queue bc done in init
> // allocate some mem for body
> frame.body = apr_palloc(r->pool,filename_size);
> strcpy(frame.body, filename);
>
> apr_status_t rc;
> rc = stomp_write(connection, &frame, r->pool);
>
>
> I am not calling stomp_read anywhere so I am unsure as to why my message is
> being dequeued as soon as it is enqueued.
>
> Thanks
>
I'm guessing the client subscribes with ack mode auto ack, and the 
default prefetch is used so a Message will be dispatched to your client 
as soon you subscribe.  You can subscribe with a different ack mode like 
client ack and then the message is only removed on the broker side once 
you ack it.

You don't need to subscribe to send a message so not subscribing would 
also solve your issue.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/

www.camelone.org : The open source integration conference:


Mime
View raw message