Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4A38A200C04 for ; Tue, 24 Jan 2017 22:57:09 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 48DBF160B3E; Tue, 24 Jan 2017 21:57:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 69A29160B38 for ; Tue, 24 Jan 2017 22:57:08 +0100 (CET) Received: (qmail 3996 invoked by uid 500); 24 Jan 2017 21:57:07 -0000 Mailing-List: contact users-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@qpid.apache.org Delivered-To: mailing list users@qpid.apache.org Received: (qmail 3984 invoked by uid 99); 24 Jan 2017 21:57:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2017 21:57:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id AD98CC20AB for ; Tue, 24 Jan 2017 21:57:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.98 X-Spam-Level: * X-Spam-Status: No, score=1.98 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=rubikloud-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id oXa9CA_EW6E2 for ; Tue, 24 Jan 2017 21:57:04 +0000 (UTC) Received: from mail-vk0-f54.google.com (mail-vk0-f54.google.com [209.85.213.54]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 8DB5F5F296 for ; Tue, 24 Jan 2017 21:57:03 +0000 (UTC) Received: by mail-vk0-f54.google.com with SMTP id k127so121839320vke.0 for ; Tue, 24 Jan 2017 13:57:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rubikloud-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=YDCF1gKs19OtTgHC1pjFL2I82+9DJILNCxUF/i6tETM=; b=oJCMzqMvR4r0aUSsVZBoaY6khRu/aIMtyI8xfGesfp33fe4UcYWtFGDBLhQAOSt6Gw rBhHbvMToheapfl2VYsDHyzq31n4fD0jeGTTGubNCYVFP2/WNdT/eF5IqRmOIPdjZ81a MnXdVP9twsA1GuFRer3znzpKlPxfhITpRJnsmXDf0ky9GRQC5L+ZnD0E+/CH333zX+ww SI/yMEiHrHv5XAQHm0ESSFjPsw6Fm+zm6ahIz43me6LougPkXX0cB49QsaS3BiBuA5iX +UWxUvP5sLWXikpRRAV+Ayh5DLjAxtm5xyBWQQEx6kUObcijIsgatpYsVj2CVsAF+ZJj RVtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=YDCF1gKs19OtTgHC1pjFL2I82+9DJILNCxUF/i6tETM=; b=CyFF1rGf1hPtI94Rn9OB/jQ8axXmvGzv19pLZBb8VFSLR5AXkQRc+TvTgs4l4yxd+k YRTAu9NFvpATOVUg9Q/xJraNNhx9NakFJmoTMYRXN5Zpe55eNYWNoKBxgPvqxwlFIkfE b++YZHZFq64/n8nX1kCCbE3RRKocNQBDS56QrKTAVkVPP73VtLYJiz4tkUP/kJqXeLFz D+XuE/t9cnSGI2rY3GS/yHvIRbyN11j73SdqprdDGnG7rz39W00TSQfLiMAXLTckKfE7 3f2SEGjl7SFtWCupha4HdIEO7jkrhFFlBEropXQpkUdor5rNh81eEPZ4D/9u2KjNXdku UwQQ== X-Gm-Message-State: AIkVDXIY9jpSN4TwSvuP2dU2P/mCMUtDIWNTxrvVHpY+Xff1c/FPW1TgPzXDNKz1vIOFiG/OBG0AQJltWNIPmYnE X-Received: by 10.31.183.136 with SMTP id h130mr16847354vkf.131.1485294983544; Tue, 24 Jan 2017 13:56:23 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Michael Lam Date: Tue, 24 Jan 2017 21:56:13 +0000 Message-ID: Subject: Re: Indivdual Message Ack over JMS (warning: ugly hack inside) To: "users@qpid.apache.org" Content-Type: multipart/alternative; boundary=001a11439dace1a5700546de2f44 archived-at: Tue, 24 Jan 2017 21:57:09 -0000 --001a11439dace1a5700546de2f44 Content-Type: text/plain; charset=UTF-8 Thanks. Good thing JMS Session guarantees onMessage cannot be called concurrently, so this feature is still quite useful :) On Tue, 24 Jan 2017 at 16:23 Michael Lam wrote: Turns out that there's a caveat - the setting of JMS_AMQP_ACK_TYPE stores the ack type in the a JmsAcknowledgeCallback object, which is in turn used for all acknowledgements for messages. So unless a call to Message.acknowledge() is called immediately and atomically after setIntProperty(JMS_AMQP_ACK_TYPE, RELEASED), Disposition ack type will be shared across messages even if their JMS_AMQP_ACK_TYPE are set differently. Was expecting AmqpConsumer.acknowledge(ACK_TYPE) to read the ack type from each delivery and override the passed-in parameter. So make sure if you're using the mechanism, always call message.acknowledge() immediately after setIntProperty(JMS_AMQP_ACK_TYPE). On Tue, 24 Jan 2017 at 15:23 Michael Lam wrote: Ah, totally understood now. As it is, this partial implementation seems to be working. I don't mind acking all the messages if we get to assign the disposition per-message. Thanks for the insights again and I'll keep an eye on updates. On Tue, 24 Jan 2017 at 15:11 Robbie Gemmell wrote: The value set on the specific message upon which acknowledge() is called will be applied to all unacked messages on the session at the time, i.e regular JMS client-ack mode semantics, just with control over what type of disposiiton is used for the 'acks' sent due to that acknowledge() call. The intent was to make it per-message by combining with the individual-ack mode once introduced in JMS. On 24 January 2017 at 14:59, Michael Lam wrote: > Is it per message in a sense that each message will be acknowledged with an > AMQP disposition for its own JMS_AMQP_ACK_TYPE? If it is the case, it > would be per-message enough for this purpose.... > > On Tue, 24 Jan 2017 at 14:28 Robbie Gemmell > wrote: > > It isn't per-message (unless you can ack every message as you receive > it, before seeing the next one, in which case it is effectively > per-message) but rather per-session acking of all unacked messages, > but the intent was it would become fully per-message once JMS added > individual ack, which seemed well under way in terms of discussion for > inclusion in JMS 2.1: https://java.net/jira/browse/JMS_SPEC-95. Now > that JMS 2.1 has been dropped from Java EE 8 the situation is less > clear. > > On 24 January 2017 at 14:05, Michael Lam wrote: >> Hi Robbie, thanks again - just as I thought I have exhausted all means of >> achieving this, the mailing list shows me another possibility. I was >> totally prepared to implement client-side message persistance and client >> resend / recover in case nothing works - it's simple but carries too much >> baggage. >> >> My use case needs to selectively RELEASE or ACCEPT the message based on >> whether the content of the message matches an external state, so I cannot >> apply the same disposition type to all unacknowledged message - or is the >> disposition type evaluated on a per-message basis? If it works >> per-message, I can at least use a less ugly hack :) >> >> >> >> On Tue, 24 Jan 2017 at 13:26 Michael Lam > wrote: >> >>> This topic was brought up quite a few times so I'm not here to ask for > the >>> feature. Instead, it is an attempt to share some workarounds, some might >>> find it useful, some might not. >>> >>> Broker: Azure Message Bus (it could be useful for some other AMQP 1.0 >>> brokers too). >>> It supports a "peek lock" mode, where a receiver is given exclusive > access >>> to a message until it is "unlocked" (and it'll be redelivered) or >>> "deleted". The broker automatically unlocks a message after the "peek > lock >>> timeout". >>> >>> In AMQP-ish speak, the broker will periodically re-enqueue a message > until >>> a client ACCEPTS ("deletes") or RELEASES ("unlock") it. >>> >>> AMQP supports individual message acks, but JMS doesn't. Now, if the >>> broker fully supports JMS delayed delivery, the effect of releasing a >>> single message can easily be achieved by the receiver re-publish any >>> message it does not want to acknowledge, asking the broker to delay the >>> enqueue. >>> >>> So this was the first venue I pursued. Unfortunately, I found out that >>> Azure Service Bus's scheduled publishes is exposed through AMQP > Management >>> request/response of Azure extensions, instead of recognising the >>> "x-opt-delivery-time" message annotation. Hopefully this can change. >>> >>> Meanwhile, after looking at the Qpid JMS Client (verison 0.20), I was >>> able to devise a contained hack (ugly because it makes use of non-public >>> fields and methods, but only a few lines of logic) that essentially: >>> 1. wrap around a JmsConnection with a custom ProviderListener that allows >>> extraction of the JmsInboundMessageDispatch envelope in onInboundMessage, >>> which runs before onMessage. This allows me to store a map that goes > from >>> JMS Message Id to the envelopes. >>> 2. instead of calling Message.acknowledge(), a call to >>> JmsConnection.acknowledge(JmsInboundMessageDispatch, ACK_TYPE) is made > for >>> the envelope remembered in step 1 above. If it is called with RELEASE, > it >>> will redeliver the message right away. If it is called with ACCEPT, the >>> single message is acknowledged and removed. If the calling of > acknowledge >>> is skipped, after the peek lock timeout, the message will be redelivered > - >>> so it will ack like a "RELEASE with delayed redelivery". >>> >>> After some testing it seems to allow me to sneak in a non-standard >>> acknowledgement type. I still hope that delayed publish will one day > work, >>> though, understanding this hack probably won't work with the next Qpid > JMS >>> Client release. >>> >>> (I know that simply re-publish a message, even without a delay, can >>> roughly simulate a message RELEASE, but having the message redelivered >>> immediately is not what I'm after). >>> >>> It may help, or it may serve as a warning about what NOT to do with Qpid. >>> >>> Cheers, >>> Michael >>> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org > For additional commands, e-mail: users-help@qpid.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org For additional commands, e-mail: users-help@qpid.apache.org --001a11439dace1a5700546de2f44--