Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5310317BC1 for ; Sun, 5 Apr 2015 15:36:44 +0000 (UTC) Received: (qmail 42906 invoked by uid 500); 5 Apr 2015 15:36:44 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 42854 invoked by uid 500); 5 Apr 2015 15:36:44 -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 42841 invoked by uid 99); 5 Apr 2015 15:36:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Apr 2015 15:36:43 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tbain98@gmail.com designates 209.85.213.182 as permitted sender) Received: from [209.85.213.182] (HELO mail-ig0-f182.google.com) (209.85.213.182) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Apr 2015 15:36:39 +0000 Received: by igblo3 with SMTP id lo3so6790416igb.0 for ; Sun, 05 Apr 2015 08:34:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=AweMrLC7rllugIGs9tiE149LzqSzMM+Wx+ui/Yz+Xxo=; b=0OijCWggtt/jjvKUVfqRj4h+SO5lEBNYtmLzAGWS/fB+adGM9REeAn995BFaHkHSlo dkVclM3rhqy4Gvf1BfS9lDB7ua/G5YkT5WHSZWOCmd/bKUQR9Lr0ck4ErCPAJOl/PtoP fEziVE9UPeXB2QYODFiKXAI1wKEA/sUdLi/vGsuzyWiWDKignu7X5jmf7/X0ouR2kUj3 kVY+u+Gnz9MJ7nWxxyUnuJEq/p71+lc3c8lGUf5QDX4CRSAD3kcae3aPPN1Ytn9L81sE UOnNL/DdeI2gYNS111JqDAXRLhhexK9JPI4qbwjiG+quUrDVdeEBZjkJn7OtO4l5vymH tXCw== MIME-Version: 1.0 X-Received: by 10.50.126.33 with SMTP id mv1mr17483842igb.27.1428248044245; Sun, 05 Apr 2015 08:34:04 -0700 (PDT) Sender: tbain98@gmail.com Received: by 10.50.131.233 with HTTP; Sun, 5 Apr 2015 08:34:04 -0700 (PDT) Received: by 10.50.131.233 with HTTP; Sun, 5 Apr 2015 08:34:04 -0700 (PDT) In-Reply-To: References: Date: Sun, 5 Apr 2015 09:34:04 -0600 X-Google-Sender-Auth: _YO_KlXIfRes6Pdz7ZgfA2-swb0 Message-ID: Subject: Re: JMS message ID set based on sequence and overwrites the client specified JMS message id? From: Tim Bain To: ActiveMQ Users Content-Type: multipart/alternative; boundary=047d7b2e140b5417920512fbe9b7 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b2e140b5417920512fbe9b7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I think you'd be better off implementing this in the consumer as a Map with a periodic task to remove IDs that are more than N seconds old. I'm assuming you're only try to prevent dupes within a certain time window; avoiding them forever could use a HashSet but I'd worry about OOMing, so hopefully a limited time window is good enough. If you implement this in the broker, 1) you don't protect against a duplicate message sent after the consumer has processed the first one, and 2) you tax the broker's memory, rather than putting the burden on the consumer (and it would be a lighter burden for the consumer because the consumer only has to worry about messages destined for it). Tim On Apr 4, 2015 9:11 PM, "Kevin Burton" wrote: > I already have a task on my list to implement priority in the memory > store. So once I start that work, in theory , I could implement some sor= t > of (optional) functionality to support unique messages since they=E2=80= =99re > already in the hash table. > > Something like JMS.PrimaryKey or JMS.UniqueIdentifier. > > Totally proprietary of course but basically if the header isn=E2=80=99t s= et the > memory store would behave as normal. > > Thoughts not this feature? I=E2=80=99d like to land it eventually but I = guess if > there=E2=80=99s a strong -1 for this what I could do is just make a small= patch > that I can land and build my own proprietary ActiveMQ. But at least at > that point I would get JMS priorities. > > > > On Sat, Apr 4, 2015 at 4:46 PM, John D. Ament > wrote: > > > Hi Kevin, > > > > I think from the spec's perspective the behavior you're seeing is the > > expected behavior. > > > > > > > https://jms-spec.java.net/2.0/apidocs/javax/jms/Message.html#setJMSMessag= eID(java.lang.String) > > > > Basically, we intend this method to be used only by the implementor, no= t > > the client. > > > > I know what your next question might be - why does the JMS spec expose > > methods that should only be used by implementors? > > > > Well, we thought about removing methods like this, deprecating them, et= c. > > We couldn't do things that would break backwards compatibility. This > > method is used when you have two implementors running in parallel, say > you > > have ActiveMQ side by side with HornetQ and you wanted to bridge messag= es > > between the two. HornetQ may need to override the message ID going int= o > > their system. (Just an example). > > > > John > > > > On Sat, Apr 4, 2015 at 7:09 PM, Kevin Burton wrote= : > > > > > I=E2=80=99m trying to generate unique message IDs so that I can idemp= otently > > > produce messages from our =E2=80=98loader=E2=80=99 so that items don= =E2=80=99t get processed > more > > > than once. > > > > > > The JMS Message ID should do that .. but it looks like when I call > > > producer.send() it=E2=80=99s ALWAYs overwritten by a custom message I= D: > > > > > > > > > In ActiveMQSession.send it just overwrites it: > > > > > > msg.setMessageId(new > > MessageId(producer.getProducerInfo().getProducerId(), > > > sequenceNumber)); > > > > > > =E2=80=A6 so no matter WHAT I want to send , it=E2=80=99s just overwr= itten. > > > > > > I=E2=80=99m really hoping I=E2=80=99m doing something or that this is= just a bug > because > > it > > > would be a shame to lose this feature. > > > > > > -- > > > > > > Founder/CEO Spinn3r.com > > > Location: *San Francisco, CA* > > > blog: http://burtonator.wordpress.com > > > =E2=80=A6 or check out my Google+ profile > > > > > > > > > > > > > > > -- > > Founder/CEO Spinn3r.com > Location: *San Francisco, CA* > blog: http://burtonator.wordpress.com > =E2=80=A6 or check out my Google+ profile > > > --047d7b2e140b5417920512fbe9b7--