Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E80C8102F0 for ; Wed, 9 Oct 2013 19:06:45 +0000 (UTC) Received: (qmail 25339 invoked by uid 500); 9 Oct 2013 19:06:44 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 25247 invoked by uid 500); 9 Oct 2013 19:06:43 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 24894 invoked by uid 99); 9 Oct 2013 19:06:42 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Oct 2013 19:06:42 +0000 Date: Wed, 9 Oct 2013 19:06:42 +0000 (UTC) From: "ritesh (JIRA)" To: dev@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AMQ-4793) issue with messageSelector MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMQ-4793?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D137907= 28#comment-13790728 ]=20 ritesh commented on AMQ-4793: ----------------------------- Thanks for the reply. Ok, I will use receive(timeout), but my problem is it's not guaranty that e= very time when i ask for message(with messageSelector) message will be ther= e. So, take below same example if my messageSelector is "JMSCorrelationID =3D = '4544'", now there is no match for this selector and using .receive(1000).= =20 Consumer will wait for 1000ms unnecessary. Which does impact on my performa= nce any other way i can use messageSelector and didn't wait for amount of t= ime specified with receive (if message is not there). This problem occurs o= nly if no match messageSelector. =20 > issue with messageSelector > -------------------------- > > Key: AMQ-4793 > URL: https://issues.apache.org/jira/browse/AMQ-4793 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Reporter: ritesh > > Having issue with message selector. > Message is already there in queue (I can confirm with activeMQ browser ap= p).=20 > Create consumer with messageSelector and do consumer.receiveNoWait() alwa= ys receive NULL message. > Have only three message in queue. > code sample... > try > { > =20 > ActiveMQConnectionFactory connectionFactory =3D new ActiveMQC= onnectionFactory("tcp://localhost:61616"); > Connection connection=3D connectionFactory.createConnection()= ; > connection.start(); > Session session=3D connection.createSession(false,Session.AUT= O_ACKNOWLEDGE); > Destination queueDestination =3D session.createQueue("TestQue= ue"); > //using activeMq browser app i can see message is there with= JMSCorrelationID=3D12345=20 > String messageSelector=3D "JMSCorrelationID =3D '12345'"; > MessageConsumer consumer=3D session.createConsumer(queueDest= ination,messageSelector); > Message message=3D consumer.receiveNoWait(); > if(message=3D=3Dnull) > { > // always return null message > //log message not found > } > =20 > } > catch (Exception e) > { > } > But, if do this it=E2=80=99s works =E2=80=A6 > For(int i=3D0; i< 7; i++) > { > =09Thread.sleep(100); > message=3D consumer.receiveNoWait();=09 > =09If(message!=3Dnull) > =09=09Break; > } > please help me what am i doing wrong? -- This message was sent by Atlassian JIRA (v6.1#6144)