[
https://issues.apache.org/jira/browse/BOOKKEEPER-311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13409467#comment-13409467
]
Sijie Guo commented on BOOKKEEPER-311:
--------------------------------------
thanks for Mridul for explaining details.
from your explanation, actually what you need is different ack guarantees. so
we could categorized the semantics of consume into several groups:
1) just guarantee sending consume request to local netty layer : if channel is
closed before consume request written to server by netty, the consume request
is lost. we would get duplicated messages.
2) just guarantee writing consume request to channel : if hub server is down
before processing the consume request. we still get duplicated messages.
3) guarantee consume request is processed by hub server : we need response for
consume request. in reality, we might not need such guarantee. I wrote it here,
is just for completeness.
so I think the better idea is to extend 'consume' api to support
different-level consume guarantee, instead of introducing 'asyncConsume' api. I
wrote an initial idea as below:
{code}
enum ConsumeMode {
// provide different guarantee levels as described above.
// I had no good names for it.
}
public void consume(topic, subscriberId, messageSeqId);
public void consume(topic, subscriberId, messageSeqId, ConsumeMode);
{code}
the original consume api still keeps semantic just sending consume requests to
netty layer. we don't need to break the backward compatibility. and it makes
semantic more clearly and extensible. also it could resolve the issue you
mentioned.
@Mridul @Ivan, how are your opinions?
> Changes in hedwig client api to support JMS spec
> ------------------------------------------------
>
> Key: BOOKKEEPER-311
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-311
> Project: Bookkeeper
> Issue Type: Sub-task
> Reporter: Mridul Muralidharan
> Attachments: hedwig-client-consume.patch.1,
> hedwig-client-publish.patch.1, hedwig-client.patch
>
>
> Primary changes are :
> a) Add support for returning seq-id for a publish request. This is an api
> change (backwardly compatible for users).
> b) Make consume a sync consume, with addition of an asyncConsume - this is to
> ensure that invoking consume() ensure request makes to server before
> returning (with what reasonable gaurantees that netty allows).
> c) Ensure that explicit close'ing of session will flush buffered consume
> seq-id's when auto-ack is enabled (default in hedwig java client).
> In addition, there are also fixes for
> d) Fix NPE's observed as part of testing JMS provider.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira