Messages would be re-delivered when attached to the subscription again if they are not consumed by the client.
By default, 'auto-consume' in enable in hedwig client, so when you call 'cb.operationFinished', the client would try to auto-consume the message for you. But for performance, the auto-consume is done in batch. It was controlled by a setting 'consumed_messages_buffer_size', by default is 5. You could set it to 1, which means consume each time when you call cb.operationFinished. You could tune this number according to your traffic to use it in best way. Another solution is you could disable auto-consume and consume yourself by calling #consume(topic, subscriber, message_seq_id). -Sijie On Fri, Jan 4, 2013 at 10:06 AM, suman p <[email protected]> wrote: > Hi, > > I wrote a sample app which listens to hedwig topic and prints the message > published to topic on console. > > Here is the main class code > > https://gist.github.com/4454564 > > Here is the message handler code > > https://gist.github.com/4454575 > > > Inside message handler i am just printing the message to console and > calling cb.operationFinished(context, null); to mark operation success > > > I did the following steps to understand the hedwig functionality > > > 1) I ran the main class and published m1, m2 messages to topic T3 from > hedwig console (using "pub" command). > > 2) Message handler successfully logged those messages to the console. > > 3) Now i shut down the main class and published m3, m4 messages to topic > T3. > > 4) I started the main class again > > 5) Now my message handler printed m1, m2, m3, m4 messages to the console. > > What i expected is, in step 5, my message handler should receive only m3, > m4 but not m1, m2 again since m1, m2 is processed successfully and m3, m4 > messages came when main class is not running. > > is this is the correct behavior of hedwig or am i doing some thing wrong? > > how i can adjust my code to make my message handler to receive only m3, m4 > messages when i restarted the main class. > > BTW, I am using hedwig-4.1.0 release. > > > Regards, > > Suman > > >
