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 4142F200D18 for ; Wed, 11 Oct 2017 10:46:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3F41B1609E4; Wed, 11 Oct 2017 08:46:13 +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 5C74A1609CA for ; Wed, 11 Oct 2017 10:46:12 +0200 (CEST) Received: (qmail 73791 invoked by uid 500); 11 Oct 2017 08:46:11 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 73770 invoked by uid 99); 11 Oct 2017 08:46:10 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Oct 2017 08:46:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 23EC81953A6 for ; Wed, 11 Oct 2017 08:46:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.701 X-Spam-Level: X-Spam-Status: No, score=0.701 tagged_above=-999 required=6.31 tests=[AC_DIV_BONANZA=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, KAM_LIVE=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.8, RCVD_IN_SORBS_SPAM=0.5] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=camline-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id I1jjHVRDnKyR for ; Wed, 11 Oct 2017 08:46:07 +0000 (UTC) Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 06CD45F39D for ; Wed, 11 Oct 2017 08:46:05 +0000 (UTC) Received: by mail-pf0-f197.google.com with SMTP id a84so3313411pfk.5 for ; Wed, 11 Oct 2017 01:46:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=camline-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=7IQ+89Yte78pG/H8fJ/PRFoN/ztpR2u76FeRMbYTGw0=; b=HY4I+2okIuwv5V6vZhEU4CV8vRc7HH46dbp3tt62vlNO9q8U8jtrUdCp/SmpH1jCxY RIJsquCYk0ovEAwlXk3+v7152t/Ybm+8PAVzglsVIcOWSZydYwQX+cil7uo+Pqsl8Om9 T/Vb/A8bHwFclMShsHEnEl8TigOnloBAm2EbSUHOcnE20g7YxnKPyFXM6FABtdJtnM5R V5MGYwOgzux+i1LEAnALiYof/nMywo7K45Yk8VrDNK12orTaDhahwQw5VfBAtgBqtMYW Lt++L98WYVIoZN/dNOzoQYMxYFjCHlx+aHFJtOP6ylK7NSUGXYUy+Bk3jnYujpOEu7vp H8eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7IQ+89Yte78pG/H8fJ/PRFoN/ztpR2u76FeRMbYTGw0=; b=h0gF4Qa9XJEO5NahceIHaiAqBUCdL2VBWMnD3tUixStFp+wWNWXj6iGEEV6PcWVMMq m5VheA/V0lwvNNfkGsmQH0BK+NaK9+WVpJ3Lm7QSqhh3VoMyXJPguTattfsG1tSkKNc1 ni166B0hywNN+gxudeqCXi+fUk3RzK9mollo3B4Ljbk6NkABhcjjqP1yCuGpiDQKsPhs rUwz+M6XdUekIO+W+Netr2bja/j9l73a1XDzoL8PBS4ewxpSsU1yZu9c5HF4+ho0JZQY lvbmU5SMUWK7h1X2hK447Pp7DyMkLpbl0b3WG2DSBsUHdcuQrlcoNSJuKUpvNle+2tDg +bzg== X-Gm-Message-State: AMCzsaU18EJyZJzhia2BFNktSRAYWm/bTilUZkku87zrdSSxOpomkCRI CJ7dmbCfXy87QtWRKN4Ejqj7FsI4bjEqWNQif9LcLX4/zg0ON0PYxrFiqT4ouaWbZ5nTlgebcoK B6T/jbpMpR5QKYeUBNlCMj9Rhe03t8w== X-Google-Smtp-Source: AOwi7QB6enMpuupG02DJsU2ejdtbDPeTZ2hPagcLtP+yD/s7UTqob9/hA621u357fMP8RnVa4k8JDjg5puMSNslttaA= X-Received: by 10.101.69.6 with SMTP id n6mr14693204pgq.290.1507711564061; Wed, 11 Oct 2017 01:46:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.226.139 with HTTP; Wed, 11 Oct 2017 01:46:03 -0700 (PDT) From: Matthias Hanisch Date: Wed, 11 Oct 2017 10:46:03 +0200 Message-ID: Subject: Re: How to put "properties" on a message so they are accessible later To: users@activemq.apache.org Content-Type: multipart/alternative; boundary="089e0822d4ac333280055b4174b8" archived-at: Wed, 11 Oct 2017 08:46:13 -0000 --089e0822d4ac333280055b4174b8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, let me explain a similar use case what we would use to show that there is a demand for modification of application properties: We would like to enrich an AMQP message with additional application properties for better filtering and message routing. As far as I understood from the discussion below this is not possible by calling message.putStringProperty("new_prop", "new_prop_value") I tried to do this in an AmqpInterceptor but the listener still gets the original message without this added property. And therefore the listener can also not create a message selector based on the new application properties. I also checked the spec and I could not find a reference that application properties are immutable. For "pure" properties this seems to be true according to section 3.2.4 of the spec. The only way I can think of is to use a listener which creates a new message with the enriched context and uploads it back to the broker. This would duplicate a lot of messages and would impact performance. A more efficient way to realize this feature would be greatly appreciated. Best regards, Matthias P.S.: I just subscribed to this mailing list so I was not able to reply directly to the mail below. Sorry about that. ---------- Weitergeleitete Nachricht ---------- > From: Clebert Suconic > To: users@activemq.apache.org > Cc: > Bcc: > Date: Tue, 10 Oct 2017 20:18:38 -0400 > Subject: Re: How to put "properties" on a message so they are accessible > later > We could add a new method call to the plugin... something like > replaceMessage. > > With that on hand you could then convert the AMQPMessage to a Core > Message using message.toCore().. and return the transformed message. > > > The message wouldn't be an AMQP message any longer from that point > on.. it would eventually be converted back to whatever other message > protocols it leads on the other side... it would of course have some > performance impact but it would work. > > On Tue, Oct 10, 2017 at 5:55 PM, Timothy Bish wrote= : > > On 10/10/2017 05:20 PM, Harrison Tarr wrote: > >> > >> Thanks for the quick reply. Is there any way to change something on th= e > >> message that my consumer could then access? Maybe not > ApplicationProperties > >> but something else? > > > > > > Nothing that would be accessible via the JMS client API. > > > > > >> Harrison > >> > >> -----Original Message----- > >> From: Timothy Bish [mailto:tabish121@gmail.com] > >> Sent: Tuesday, October 10, 2017 2:11 PM > >> To: users@activemq.apache.org > >> Subject: Re: How to put "properties" on a message so they are accessib= le > >> later > >> > >> On 10/10/2017 05:06 PM, Harrison Tarr wrote: > >>> > >>> Hello again, > >>> > >>> I wanted to follow up on this as I've done some more experimenting. > >>> I've found that when I use the Core protocol or Openwire protocol, > >>> everything works as expected. I am able to use the "setStringProperty= " > >>> in my ActiveMQServerPlugin and it adds a header that I can then acces= s > >>> in my Camel consumer code. However, if I try to add a property to a > >>> message that was sent using the AMQP protocol, it does not stay set o= n > >>> the message. It appears to me that this is because the AMQP message i= s > >>> more protected? Maybe it has all of the data in an immutable > >>> ByteBuffer? I've tried using the "reencode" method on the > >>> org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage class, > >>> but it causes an error; it can't parse the message back out, it says > >>> something about an unknown constructor. (Being handled here > >>> https://github.com/apache/qpid-jms/blob/master/qpid-jms-client/src/ma= i > >>> n/java/org/apache/qpid/jms/provider/amqp/AmqpConsumer.java#L496) > >> > >> AMQP ApplicationProperties are immutable so you cannot change or add t= o > >> them in flight, that would violate the AMQP specification. > >> > >>> Justin, I've looked at the remoting interceptors. I think I decided > >>> against using them because it does not expose as much information to > me as I > >>> wanted. I'm specifically trying to take the authentication credential= s > and > >>> then create some kind of authentication token to attach to the messag= e > that > >>> I can then use in my consuming code. > >>> > >>> Regards, > >>> Harrison Tarr > >>> > >>> > >>> -----Original Message----- > >>> From: Justin Bertram [mailto:jbertram@redhat.com] > >>> Sent: Tuesday, September 12, 2017 3:28 PM > >>> To: users@activemq.apache.org > >>> Subject: Re: How to put "properties" on a message so they are > >>> accessible later > >>> > >>> I'm not terribly familiar with the ActiveMQServerPlugin functionality > in > >>> this regard, but I do know that you can make such modifications to > messages > >>> using remoting interceptors. Have you explored that possibility? > >>> > >>> > >>> Justin > >>> > >>> On Tue, Sep 12, 2017 at 3:45 PM, Harrison Tarr > >>> > >>> wrote: > >>> > >>>> Right now I'm using Artemis 2.2.0. > >>>> I've done a bit more research and experimentation. It seems that I > >>>> can set a header in Camel, send the message to a queue/topic hosted > >>>> on Artemis and read the header as a "stringProperty". The header key= s > >>>> also show up when I do a "getProperties" call. However, if I try to > >>>> overwrite that field in my ActiveMQServerPlugin (specifically the > >>>> beforeSend call), the change is not propagated to Camel. IE, if I > send a > >>>> message with the header "testHeader" > >>>> with a value of "testValue", I can see, in Artemis, "testHeader" as = a > >>>> property on the message with the value of "testValue". If I then try > >>>> to overwrite that value with "newValue", when I access the message > >>>> and its headers in the consumer, the header is still "testHeader" > >>>> with the value of "testValue", whereas I expect it to be "testHeader= " > >>>> with a value of "newValue". > >>>> > >>>> Harrison Tarr > >>>> > >>>> -----Original Message----- > >>>> From: tbain98@gmail.com [mailto:tbain98@gmail.com] On Behalf Of Tim > >>>> Bain > >>>> Sent: Monday, September 11, 2017 6:26 PM > >>>> To: ActiveMQ Users > >>>> Subject: RE: How to put "properties" on a message so they are > >>>> accessible later > >>>> > >>>> To be clear, you're asking about doing this in Artemis, not ActiveMQ > >>>> 5.x, right? What version of Artemis? > >>>> > >>>> On Sep 11, 2017 2:48 PM, "Harrison Tarr" > >>>> wrote: > >>>> > >>>>> I just wanted to follow up: Does anyone know how to put an > >>>>> attribute/property on a message in an ActiveMQServerPlugin that I > >>>>> can then pull out of the message in Camel? > >>>>> > >>>>> Regards, > >>>>> Harrison Tarr > >>>>> > >>>>> -----Original Message----- > >>>>> From: Harrison Tarr [mailto:harrison.tarr@connexta.com] > >>>>> Sent: Wednesday, September 6, 2017 8:56 AM > >>>>> To: users@activemq.apache.org > >>>>> Subject: How to put "properties" on a message so they are accessibl= e > >>>>> later > >>>>> > >>>>> Hi, > >>>>> > >>>>> I'm trying to put a StringProperty on a Message in an > >>>>> ActiveMQServerPlugin. As far as I can tell, the property gets set > >>>>> correctly. Later, I'm trying to retrieve the property from a Camel > >>>>> Exchange. I don't see my property anywhere on the Exchange. I did > >>>>> notice that it looks like the properties "firedTime" and > >>>>> "breadcrumbId," which I think come from Artemis, do appear on the > >>>>> Camel Exchange, which makes me think there is some way to propagate > >>>>> my > >>>> > >>>> property from Artemis to Camel. > >>>>> > >>>>> Regards, > >>>>> Harrison Tarr > >>>>> > >> -- > >> Tim Bish > >> twitter: @tabish121 > >> blog: http://timbish.blogspot.com/ > >> > > > > -- > > Tim Bish > > twitter: @tabish121 > > blog: http://timbish.blogspot.com/ > > > > > > -- > Clebert Suconic > > > --=20 camLine GmbH 85238 Petershausen, Industriering 4a, Deutschland Amtsgericht M=C3=BCnchen HRB 88821 Gesch=C3=A4ftsf=C3=BChrer: Heinz Linsmaier (CEO), Bernhard Jofer, Georg Rue= tz =20 --089e0822d4ac333280055b4174b8--