You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Jan Bares <ja...@wood.cz> on 2012/11/07 10:09:35 UTC

Java client and message release or reject

Hi,

how can I release or reject a message in Java client? JMS API has no methods like that. What is the suggested method?

Thanks, Jan




DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as Host State regulators.  For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.cz under section Corporate Governance. 

Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment  research opinions. 

This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Java client and message release or reject

Posted by Robbie Gemmell <ro...@gmail.com>.
The naming basically looks to be the result of some naming decisions taken
(probably to preserve the existing API, but I dont know as it was before my
time) when bolting the AMQP 0-10 support on to the existing 0-8/0-9 client,
combined with changes in functionality between 0-9 and 0-10. There was no
release in 0-9 but instead a reject command used in a similar'ish way,
which is nothing like the reject 0-10 has. It would seem the client makes
no use of the AMQP 0-10 reject command because none of the JMS
functionality actually required it to do so, but its there in the
underlying AMQP implementation as you have noticed.

I wouldnt have a particular problem with adding a new reject command to the
session or consumer, but I think I would only add it to the 0-10 specific
implementation classes given the functionality is less general and more
0-10 specific. I'd choose the method over handling a particular type of
exception because it would then be agnostic to onMessage() vs recieve(),
but also because throwing exceptions out of onMessage() is something you
are explicitly meant to avoid and I wouldnt want to start encouraging it.

Patches welcome..

Robbie


On 9 November 2012 14:13, Jan Bares <ja...@wood.cz> wrote:

> Thanks Pavel,
>
> I already tried this method and found it does call release, not reject. It
> seems it is there to support Java broker way of rejecting. I did a dirty
> hack and call directly SessionInvoker.messageReject(). It works but I dont
> like this solution. In my opinion the AMQSession.rejectMessage() should
> call reject and anyone who want to go beyond JMS API will have to use the
> code bellow.  Gordon suggested to use special exception thrown from
> MessageListener - this will not work for non listener code.
>
> Thank you, Jan
>
> > -----Original Message-----
> > From: Pavel Moravec [mailto:pmoravec@redhat.com]
> > Sent: Friday, November 09, 2012 2:59 PM
> > To: users@qpid.apache.org
> > Subject: Re: Java client and message release or reject
> >
> > Hi Jan,
> > greping source code, I found just one possibility:
> >
> >             ((AMQSession) ssn).rejectMessage((AbstractJMSMessage) msg,
> > false);
> >
> > that however does not invoke message.reject AMQP method, but rather
> > message.release method. I.e. it releases the message, not rejects.
> >
> > So I think there is no way how to reject a message in qpid Java client.
> >
> > Surely one can use message filters to get only selected messages, but the
> > messages not matching the filter would remain in the queue further.
> >
> > Kind regards,
> > Pavel
> >
> >
> > ----- Original Message -----
> > > From: "Jan Bares" <ja...@wood.cz>
> > > To: users@qpid.apache.org
> > > Sent: Thursday, November 8, 2012 6:13:57 PM
> > > Subject: RE: Java client and message release or reject
> > >
> > > Does the Java client support message reject? I am not speaking about
> > > JMS API, but it seems that even internally there is no support for
> > > reject, just release (and redeliver). Can someone confirm that
> > > please?
> > >
> > > Thanks, Jan
> > >
> > > > -----Original Message-----
> > > > From: Jan Bares [mailto:jan.bares@wood.cz]
> > > > Sent: Thursday, November 08, 2012 9:41 AM
> > > > To: users@qpid.apache.org
> > > > Subject: RE: Java client and message release or reject
> > > >
> > > > Hi Phil,
> > > >
> > > > I ommitted this in my question, I am using C++ broker.
> > > >
> > > > Currenlty I am testing a hack - casting JMS object to the
> > > > underlying QPID
> > > > imlementing classes and using whats available there. If anybody did
> > > > that
> > > > before me, let me know if it worked. And yes, I know its not
> > > > portable and
> > > > even may not work after upgrade but I can live with that.
> > > >
> > > > Regards, Jan
> > > >
> > > > > -----Original Message-----
> > > > > From: philharveyonline@googlemail.com
> > > > > [mailto:philharveyonline@googlemail.com] On Behalf Of Phil Harvey
> > > > > Sent: Thursday, November 08, 2012 9:31 AM
> > > > > To: users@qpid.apache.org
> > > > > Subject: Re: Java client and message release or reject
> > > > >
> > > > > Jan,
> > > > >
> > > > > I'm not sure which broker you're using.  If you're using the Java
> > > > > Broker,
> > > > > note that you can configure it to send messages to the dead
> > > > > letter queue
> > > > > after N attempts with this sort of thing in your
> > > > > virtualhosts.xml:
> > > > >
> > > > >     ...
> > > > >     <queues>
> > > > >         <maximumDeliveryCount>1</maximumDeliveryCount>
> > > > >         ...
> > > > >
> > > > > The delivery count is incremented each time the message is
> > > > > rejected by
> > > > the
> > > > > client, eg when it explicitly calls session.rollback() after your
> > > > > application code decides that its format is wrong.
> > > > >
> > > > > If that looks like it might be useful then I send a more complete
> > > > > example,
> > > > > i.e. including the specification of the alternate exchange.
> > > > >
> > > > > Phil
> > > > >
> > > > >
> > > > > On 7 November 2012 12:45, Gordon Sim <go...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > On 11/07/2012 12:11 PM, Jan Bares wrote:
> > > > > >
> > > > > >> we are planning to reject messages that do not satisfy message
> > > > > >> contract
> > > > > >> (e.g. message is of wrong format). The reject and DLQ seems to
> > > > > >> be the
> > > > > right
> > > > > >> solution for this problem.
> > > > > >>
> > > > > >
> > > > > > At present the only thing I can suggest is that you have the
> > > > > > client itself
> > > > > > send the 'rejected' message to the DLQ (or exchange or
> > > > > > whatever). You
> > > > > can
> > > > > > do this before acknowledging it to avoid losing it on failure
> > > > > > if that is
> > > > > > important.
> > > > > >
> > > > > > Longer term perhaps the JMS client could recognise a certain
> > > > > > category of
> > > > > > exception thrown by a MessageListener and interpret that as a
> > > > > > desire to
> > > > > > reject the message in question. Any thoughts on that from the
> > > > > > JMS devs?
> > > > > >
> > > > > >
> > > > > >
> ------------------------------**------------------------------**---------
> > > > > > To unsubscribe, e-mail:
> > > > > > users-unsubscribe@qpid.apache.**org<users-
> > > > > unsubscribe@qpid.apache.org>
> > > > > > For additional commands, e-mail: users-help@qpid.apache.org
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> > > >
> > > > DISCLAIMER
> > > > WOOD & Company Financial Services, a.s. and its branches are
> > > > authorized
> > > > and regulated by the CNB as Home State regulator and in Poland by
> > > > the KNF,
> > > > in Romania by the CNVM, in Slovakia by the NBS and in the UK by the
> > > > FSA as
> > > > Host State regulators.  For further information about WOOD & Co.,
> > > > its
> > > > investment services, financial instruments and associated risks,
> > > > safeguard
> > > > client assets (incl. compensation schemes) and contractual
> > > > relationship
> > > > please see our website at www.wood.cz under section Corporate
> > > > Governance.
> > > >
> > > > Unless otherwise stated, this transmission is neither an offer nor
> > > > the
> > > > solicitation of an offer to sell or purchase any investment. All
> > > > estimates,
> > > > opinions and other information contained herein are subject to
> > > > change
> > > > without notice and are provided in good faith but without legal
> > > > responsibility
> > > > or liability. Opinion may be personal to the author and may not
> > > > reflect the
> > > > opinions of WOOD & Co. Communications from sales persons, sales
> > > > traders
> > > > or traders should not be regarded as investment research and may
> > > > contain
> > > > opinions or trading ideas which are different from WOOD & Co.
> > > > investment
> > > > research opinions.
> > > >
> > > > This e-mail and any attachments are confidential and may be
> > > > privileged or
> > > > otherwise protected from disclosure. If you are not a named
> > > > addressee you
> > > > must not use, disclose, distribute, copy, print or rely on this
> > > > e-mail and any of
> > > > its attachments. Please notify the sender that you have received
> > > > this email
> > > > by mistake by replying to the email, and then delete the email and
> > > > any copies
> > > > of it. Although WOOD & Co. routinely screens e-mails for viruses,
> > > > addressees
> > > > should scan this e-mail and any attachments for viruses. WOOD & Co.
> > > > makes
> > > > no representation or warranty as to the absence of viruses in this
> > > > e-mail or
> > > > any attachments. Please note that to ensure regulatory compliance
> > > > and for
> > > > the protection of our clients and business, we may monitor and read
> > > > e-mails
> > > > sent to and from our server(s).
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> > > > For additional commands, e-mail: users-help@qpid.apache.org
> > >
> > >
> > >
> > >
> > >
> > > DISCLAIMER
> > > WOOD & Company Financial Services, a.s. and its branches are
> > > authorized and regulated by the CNB as Home State regulator and in
> > > Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS
> > > and in the UK by the FSA as Host State regulators.  For further
> > > information about WOOD & Co., its investment services, financial
> > > instruments and associated risks, safeguard client assets (incl.
> > > compensation schemes) and contractual relationship please see our
> > > website at www.wood.cz under section Corporate Governance.
> > >
> > > Unless otherwise stated, this transmission is neither an offer nor
> > > the solicitation of an offer to sell or purchase any investment. All
> > > estimates, opinions and other information contained herein are
> > > subject to change without notice and are provided in good faith but
> > > without legal responsibility or liability. Opinion may be personal
> > > to the author and may not reflect the opinions of WOOD & Co.
> > > Communications from sales persons, sales traders or traders should
> > > not be regarded as investment research and may contain opinions or
> > > trading ideas which are different from WOOD & Co. investment
> > >  research opinions.
> > >
> > > This e-mail and any attachments are confidential and may be
> > > privileged or otherwise protected from disclosure. If you are not a
> > > named addressee you must not use, disclose, distribute, copy, print
> > > or rely on this e-mail and any of its attachments. Please notify the
> > > sender that you have received this email by mistake by replying to
> > > the email, and then delete the email and any copies of it. Although
> > > WOOD & Co. routinely screens e-mails for viruses, addressees should
> > > scan this e-mail and any attachments for viruses. WOOD & Co. makes
> > > no representation or warranty as to the absence of viruses in this
> > > e-mail or any attachments. Please note that to ensure regulatory
> > > compliance and for the protection of our clients and business, we
> > > may monitor and read e-mails sent to and from our server(s).
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
>
>
>
>
>
> DISCLAIMER
> WOOD & Company Financial Services, a.s. and its branches are authorized
> and regulated by the CNB as Home State regulator and in Poland by the KNF,
> in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as
> Host State regulators.  For further information about WOOD & Co., its
> investment services, financial instruments and associated risks, safeguard
> client assets (incl. compensation schemes) and contractual relationship
> please see our website at www.wood.cz under section Corporate Governance.
>
> Unless otherwise stated, this transmission is neither an offer nor the
> solicitation of an offer to sell or purchase any investment. All estimates,
> opinions and other information contained herein are subject to change
> without notice and are provided in good faith but without legal
> responsibility or liability. Opinion may be personal to the author and may
> not reflect the opinions of WOOD & Co. Communications from sales persons,
> sales traders or traders should not be regarded as investment research and
> may contain opinions or trading ideas which are different from WOOD & Co.
> investment  research opinions.
>
> This e-mail and any attachments are confidential and may be privileged or
> otherwise protected from disclosure. If you are not a named addressee you
> must not use, disclose, distribute, copy, print or rely on this e-mail and
> any of its attachments. Please notify the sender that you have received
> this email by mistake by replying to the email, and then delete the email
> and any copies of it. Although WOOD & Co. routinely screens e-mails for
> viruses, addressees should scan this e-mail and any attachments for
> viruses. WOOD & Co. makes no representation or warranty as to the absence
> of viruses in this e-mail or any attachments. Please note that to ensure
> regulatory compliance and for the protection of our clients and business,
> we may monitor and read e-mails sent to and from our server(s).
>
>

RE: Java client and message release or reject

Posted by Jan Bares <ja...@wood.cz>.
Thanks Pavel,

I already tried this method and found it does call release, not reject. It seems it is there to support Java broker way of rejecting. I did a dirty hack and call directly SessionInvoker.messageReject(). It works but I dont like this solution. In my opinion the AMQSession.rejectMessage() should call reject and anyone who want to go beyond JMS API will have to use the code bellow.  Gordon suggested to use special exception thrown from MessageListener - this will not work for non listener code.

Thank you, Jan

> -----Original Message-----
> From: Pavel Moravec [mailto:pmoravec@redhat.com]
> Sent: Friday, November 09, 2012 2:59 PM
> To: users@qpid.apache.org
> Subject: Re: Java client and message release or reject
> 
> Hi Jan,
> greping source code, I found just one possibility:
> 
>             ((AMQSession) ssn).rejectMessage((AbstractJMSMessage) msg,
> false);
> 
> that however does not invoke message.reject AMQP method, but rather
> message.release method. I.e. it releases the message, not rejects.
> 
> So I think there is no way how to reject a message in qpid Java client.
> 
> Surely one can use message filters to get only selected messages, but the
> messages not matching the filter would remain in the queue further.
> 
> Kind regards,
> Pavel
> 
> 
> ----- Original Message -----
> > From: "Jan Bares" <ja...@wood.cz>
> > To: users@qpid.apache.org
> > Sent: Thursday, November 8, 2012 6:13:57 PM
> > Subject: RE: Java client and message release or reject
> >
> > Does the Java client support message reject? I am not speaking about
> > JMS API, but it seems that even internally there is no support for
> > reject, just release (and redeliver). Can someone confirm that
> > please?
> >
> > Thanks, Jan
> >
> > > -----Original Message-----
> > > From: Jan Bares [mailto:jan.bares@wood.cz]
> > > Sent: Thursday, November 08, 2012 9:41 AM
> > > To: users@qpid.apache.org
> > > Subject: RE: Java client and message release or reject
> > >
> > > Hi Phil,
> > >
> > > I ommitted this in my question, I am using C++ broker.
> > >
> > > Currenlty I am testing a hack - casting JMS object to the
> > > underlying QPID
> > > imlementing classes and using whats available there. If anybody did
> > > that
> > > before me, let me know if it worked. And yes, I know its not
> > > portable and
> > > even may not work after upgrade but I can live with that.
> > >
> > > Regards, Jan
> > >
> > > > -----Original Message-----
> > > > From: philharveyonline@googlemail.com
> > > > [mailto:philharveyonline@googlemail.com] On Behalf Of Phil Harvey
> > > > Sent: Thursday, November 08, 2012 9:31 AM
> > > > To: users@qpid.apache.org
> > > > Subject: Re: Java client and message release or reject
> > > >
> > > > Jan,
> > > >
> > > > I'm not sure which broker you're using.  If you're using the Java
> > > > Broker,
> > > > note that you can configure it to send messages to the dead
> > > > letter queue
> > > > after N attempts with this sort of thing in your
> > > > virtualhosts.xml:
> > > >
> > > >     ...
> > > >     <queues>
> > > >         <maximumDeliveryCount>1</maximumDeliveryCount>
> > > >         ...
> > > >
> > > > The delivery count is incremented each time the message is
> > > > rejected by
> > > the
> > > > client, eg when it explicitly calls session.rollback() after your
> > > > application code decides that its format is wrong.
> > > >
> > > > If that looks like it might be useful then I send a more complete
> > > > example,
> > > > i.e. including the specification of the alternate exchange.
> > > >
> > > > Phil
> > > >
> > > >
> > > > On 7 November 2012 12:45, Gordon Sim <go...@gmail.com>
> > > > wrote:
> > > >
> > > > > On 11/07/2012 12:11 PM, Jan Bares wrote:
> > > > >
> > > > >> we are planning to reject messages that do not satisfy message
> > > > >> contract
> > > > >> (e.g. message is of wrong format). The reject and DLQ seems to
> > > > >> be the
> > > > right
> > > > >> solution for this problem.
> > > > >>
> > > > >
> > > > > At present the only thing I can suggest is that you have the
> > > > > client itself
> > > > > send the 'rejected' message to the DLQ (or exchange or
> > > > > whatever). You
> > > > can
> > > > > do this before acknowledging it to avoid losing it on failure
> > > > > if that is
> > > > > important.
> > > > >
> > > > > Longer term perhaps the JMS client could recognise a certain
> > > > > category of
> > > > > exception thrown by a MessageListener and interpret that as a
> > > > > desire to
> > > > > reject the message in question. Any thoughts on that from the
> > > > > JMS devs?
> > > > >
> > > > >
> > > > > ------------------------------**------------------------------**---------
> > > > > To unsubscribe, e-mail:
> > > > > users-unsubscribe@qpid.apache.**org<users-
> > > > unsubscribe@qpid.apache.org>
> > > > > For additional commands, e-mail: users-help@qpid.apache.org
> > > > >
> > > > >
> > >
> > >
> > >
> > >
> > > DISCLAIMER
> > > WOOD & Company Financial Services, a.s. and its branches are
> > > authorized
> > > and regulated by the CNB as Home State regulator and in Poland by
> > > the KNF,
> > > in Romania by the CNVM, in Slovakia by the NBS and in the UK by the
> > > FSA as
> > > Host State regulators.  For further information about WOOD & Co.,
> > > its
> > > investment services, financial instruments and associated risks,
> > > safeguard
> > > client assets (incl. compensation schemes) and contractual
> > > relationship
> > > please see our website at www.wood.cz under section Corporate
> > > Governance.
> > >
> > > Unless otherwise stated, this transmission is neither an offer nor
> > > the
> > > solicitation of an offer to sell or purchase any investment. All
> > > estimates,
> > > opinions and other information contained herein are subject to
> > > change
> > > without notice and are provided in good faith but without legal
> > > responsibility
> > > or liability. Opinion may be personal to the author and may not
> > > reflect the
> > > opinions of WOOD & Co. Communications from sales persons, sales
> > > traders
> > > or traders should not be regarded as investment research and may
> > > contain
> > > opinions or trading ideas which are different from WOOD & Co.
> > > investment
> > > research opinions.
> > >
> > > This e-mail and any attachments are confidential and may be
> > > privileged or
> > > otherwise protected from disclosure. If you are not a named
> > > addressee you
> > > must not use, disclose, distribute, copy, print or rely on this
> > > e-mail and any of
> > > its attachments. Please notify the sender that you have received
> > > this email
> > > by mistake by replying to the email, and then delete the email and
> > > any copies
> > > of it. Although WOOD & Co. routinely screens e-mails for viruses,
> > > addressees
> > > should scan this e-mail and any attachments for viruses. WOOD & Co.
> > > makes
> > > no representation or warranty as to the absence of viruses in this
> > > e-mail or
> > > any attachments. Please note that to ensure regulatory compliance
> > > and for
> > > the protection of our clients and business, we may monitor and read
> > > e-mails
> > > sent to and from our server(s).
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> > > For additional commands, e-mail: users-help@qpid.apache.org
> >
> >
> >
> >
> >
> > DISCLAIMER
> > WOOD & Company Financial Services, a.s. and its branches are
> > authorized and regulated by the CNB as Home State regulator and in
> > Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS
> > and in the UK by the FSA as Host State regulators.  For further
> > information about WOOD & Co., its investment services, financial
> > instruments and associated risks, safeguard client assets (incl.
> > compensation schemes) and contractual relationship please see our
> > website at www.wood.cz under section Corporate Governance.
> >
> > Unless otherwise stated, this transmission is neither an offer nor
> > the solicitation of an offer to sell or purchase any investment. All
> > estimates, opinions and other information contained herein are
> > subject to change without notice and are provided in good faith but
> > without legal responsibility or liability. Opinion may be personal
> > to the author and may not reflect the opinions of WOOD & Co.
> > Communications from sales persons, sales traders or traders should
> > not be regarded as investment research and may contain opinions or
> > trading ideas which are different from WOOD & Co. investment
> >  research opinions.
> >
> > This e-mail and any attachments are confidential and may be
> > privileged or otherwise protected from disclosure. If you are not a
> > named addressee you must not use, disclose, distribute, copy, print
> > or rely on this e-mail and any of its attachments. Please notify the
> > sender that you have received this email by mistake by replying to
> > the email, and then delete the email and any copies of it. Although
> > WOOD & Co. routinely screens e-mails for viruses, addressees should
> > scan this e-mail and any attachments for viruses. WOOD & Co. makes
> > no representation or warranty as to the absence of viruses in this
> > e-mail or any attachments. Please note that to ensure regulatory
> > compliance and for the protection of our clients and business, we
> > may monitor and read e-mails sent to and from our server(s).
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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





DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as Host State regulators.  For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.cz under section Corporate Governance. 

Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment  research opinions. 

This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).


RE: Java client and message release or reject

Posted by Jan Bares <ja...@wood.cz>.
Is there any particular reason why rejectMessage() still calls messageRelease() ? Should I file bug report? This is from QPID 0.18.

Thanks, Jan

    /**
     * Release (0_8 notion of Reject) an acquired message
     *
     * @param deliveryTag the message ID
     * @param requeue     always true
     */
    public void rejectMessage(long deliveryTag, boolean requeue)
    {
        // The value of requeue is always true
        RangeSet ranges = RangeSetFactory.createRangeSet();
        ranges.add((int) deliveryTag);
        flushProcessed(ranges, false);
        if (requeue)
        {
            getQpidSession().messageRelease(ranges);
        }
        else
        {
            getQpidSession().messageRelease(ranges, Option.SET_REDELIVERED);
        }
        //I don't think we need to sync
    }



> -----Original Message-----
> From: Jan Bares [mailto:jan.bares@wood.cz]
> Sent: Thursday, November 08, 2012 6:14 PM
> To: users@qpid.apache.org
> Subject: RE: Java client and message release or reject
> 
> Does the Java client support message reject? I am not speaking about JMS
> API, but it seems that even internally there is no support for reject, just
> release (and redeliver). Can someone confirm that please?
> 
> Thanks, Jan
> 
> > -----Original Message-----
> > From: Jan Bares [mailto:jan.bares@wood.cz]
> > Sent: Thursday, November 08, 2012 9:41 AM
> > To: users@qpid.apache.org
> > Subject: RE: Java client and message release or reject
> >
> > Hi Phil,
> >
> > I ommitted this in my question, I am using C++ broker.
> >
> > Currenlty I am testing a hack - casting JMS object to the underlying QPID
> > imlementing classes and using whats available there. If anybody did that
> > before me, let me know if it worked. And yes, I know its not portable and
> > even may not work after upgrade but I can live with that.
> >
> > Regards, Jan
> >
> > > -----Original Message-----
> > > From: philharveyonline@googlemail.com
> > > [mailto:philharveyonline@googlemail.com] On Behalf Of Phil Harvey
> > > Sent: Thursday, November 08, 2012 9:31 AM
> > > To: users@qpid.apache.org
> > > Subject: Re: Java client and message release or reject
> > >
> > > Jan,
> > >
> > > I'm not sure which broker you're using.  If you're using the Java Broker,
> > > note that you can configure it to send messages to the dead letter queue
> > > after N attempts with this sort of thing in your virtualhosts.xml:
> > >
> > >     ...
> > >     <queues>
> > >         <maximumDeliveryCount>1</maximumDeliveryCount>
> > >         ...
> > >
> > > The delivery count is incremented each time the message is rejected by
> > the
> > > client, eg when it explicitly calls session.rollback() after your
> > > application code decides that its format is wrong.
> > >
> > > If that looks like it might be useful then I send a more complete example,
> > > i.e. including the specification of the alternate exchange.
> > >
> > > Phil
> > >
> > >
> > > On 7 November 2012 12:45, Gordon Sim <go...@gmail.com>
> wrote:
> > >
> > > > On 11/07/2012 12:11 PM, Jan Bares wrote:
> > > >
> > > >> we are planning to reject messages that do not satisfy message
> contract
> > > >> (e.g. message is of wrong format). The reject and DLQ seems to be
> the
> > > right
> > > >> solution for this problem.
> > > >>
> > > >
> > > > At present the only thing I can suggest is that you have the client itself
> > > > send the 'rejected' message to the DLQ (or exchange or whatever). You
> > > can
> > > > do this before acknowledging it to avoid losing it on failure if that is
> > > > important.
> > > >
> > > > Longer term perhaps the JMS client could recognise a certain category
> of
> > > > exception thrown by a MessageListener and interpret that as a desire
> to
> > > > reject the message in question. Any thoughts on that from the JMS
> devs?
> > > >
> > > >
> > > > ------------------------------**------------------------------**---------
> > > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<users-
> > > unsubscribe@qpid.apache.org>
> > > > For additional commands, e-mail: users-help@qpid.apache.org
> > > >
> > > >
> >
> >
> >
> >
> > DISCLAIMER
> > WOOD & Company Financial Services, a.s. and its branches are authorized
> > and regulated by the CNB as Home State regulator and in Poland by the
> KNF,
> > in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA
> as
> > Host State regulators.  For further information about WOOD & Co., its
> > investment services, financial instruments and associated risks, safeguard
> > client assets (incl. compensation schemes) and contractual relationship
> > please see our website at www.wood.cz under section Corporate
> > Governance.
> >
> > Unless otherwise stated, this transmission is neither an offer nor the
> > solicitation of an offer to sell or purchase any investment. All estimates,
> > opinions and other information contained herein are subject to change
> > without notice and are provided in good faith but without legal
> responsibility
> > or liability. Opinion may be personal to the author and may not reflect the
> > opinions of WOOD & Co. Communications from sales persons, sales traders
> > or traders should not be regarded as investment research and may contain
> > opinions or trading ideas which are different from WOOD & Co. investment
> > research opinions.
> >
> > This e-mail and any attachments are confidential and may be privileged or
> > otherwise protected from disclosure. If you are not a named addressee
> you
> > must not use, disclose, distribute, copy, print or rely on this e-mail and any
> of
> > its attachments. Please notify the sender that you have received this email
> > by mistake by replying to the email, and then delete the email and any
> copies
> > of it. Although WOOD & Co. routinely screens e-mails for viruses,
> addressees
> > should scan this e-mail and any attachments for viruses. WOOD & Co.
> makes
> > no representation or warranty as to the absence of viruses in this e-mail or
> > any attachments. Please note that to ensure regulatory compliance and for
> > the protection of our clients and business, we may monitor and read e-
> mails
> > sent to and from our server(s).
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> > For additional commands, e-mail: users-help@qpid.apache.org
> 
> 
> 
> 
> 
> DISCLAIMER
> WOOD & Company Financial Services, a.s. and its branches are authorized
> and regulated by the CNB as Home State regulator and in Poland by the KNF,
> in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as
> Host State regulators.  For further information about WOOD & Co., its
> investment services, financial instruments and associated risks, safeguard
> client assets (incl. compensation schemes) and contractual relationship
> please see our website at www.wood.cz under section Corporate
> Governance.
> 
> Unless otherwise stated, this transmission is neither an offer nor the
> solicitation of an offer to sell or purchase any investment. All estimates,
> opinions and other information contained herein are subject to change
> without notice and are provided in good faith but without legal responsibility
> or liability. Opinion may be personal to the author and may not reflect the
> opinions of WOOD & Co. Communications from sales persons, sales traders
> or traders should not be regarded as investment research and may contain
> opinions or trading ideas which are different from WOOD & Co. investment
> research opinions.
> 
> This e-mail and any attachments are confidential and may be privileged or
> otherwise protected from disclosure. If you are not a named addressee you
> must not use, disclose, distribute, copy, print or rely on this e-mail and any of
> its attachments. Please notify the sender that you have received this email
> by mistake by replying to the email, and then delete the email and any copies
> of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees
> should scan this e-mail and any attachments for viruses. WOOD & Co. makes
> no representation or warranty as to the absence of viruses in this e-mail or
> any attachments. Please note that to ensure regulatory compliance and for
> the protection of our clients and business, we may monitor and read e-mails
> sent to and from our server(s).
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org





DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as Host State regulators.  For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.cz under section Corporate Governance. 

Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment  research opinions. 

This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Java client and message release or reject

Posted by Pavel Moravec <pm...@redhat.com>.
Hi Jan,
greping source code, I found just one possibility:

            ((AMQSession) ssn).rejectMessage((AbstractJMSMessage) msg, false);

that however does not invoke message.reject AMQP method, but rather message.release method. I.e. it releases the message, not rejects.

So I think there is no way how to reject a message in qpid Java client.

Surely one can use message filters to get only selected messages, but the messages not matching the filter would remain in the queue further.

Kind regards,
Pavel


----- Original Message -----
> From: "Jan Bares" <ja...@wood.cz>
> To: users@qpid.apache.org
> Sent: Thursday, November 8, 2012 6:13:57 PM
> Subject: RE: Java client and message release or reject
> 
> Does the Java client support message reject? I am not speaking about
> JMS API, but it seems that even internally there is no support for
> reject, just release (and redeliver). Can someone confirm that
> please?
> 
> Thanks, Jan
> 
> > -----Original Message-----
> > From: Jan Bares [mailto:jan.bares@wood.cz]
> > Sent: Thursday, November 08, 2012 9:41 AM
> > To: users@qpid.apache.org
> > Subject: RE: Java client and message release or reject
> > 
> > Hi Phil,
> > 
> > I ommitted this in my question, I am using C++ broker.
> > 
> > Currenlty I am testing a hack - casting JMS object to the
> > underlying QPID
> > imlementing classes and using whats available there. If anybody did
> > that
> > before me, let me know if it worked. And yes, I know its not
> > portable and
> > even may not work after upgrade but I can live with that.
> > 
> > Regards, Jan
> > 
> > > -----Original Message-----
> > > From: philharveyonline@googlemail.com
> > > [mailto:philharveyonline@googlemail.com] On Behalf Of Phil Harvey
> > > Sent: Thursday, November 08, 2012 9:31 AM
> > > To: users@qpid.apache.org
> > > Subject: Re: Java client and message release or reject
> > >
> > > Jan,
> > >
> > > I'm not sure which broker you're using.  If you're using the Java
> > > Broker,
> > > note that you can configure it to send messages to the dead
> > > letter queue
> > > after N attempts with this sort of thing in your
> > > virtualhosts.xml:
> > >
> > >     ...
> > >     <queues>
> > >         <maximumDeliveryCount>1</maximumDeliveryCount>
> > >         ...
> > >
> > > The delivery count is incremented each time the message is
> > > rejected by
> > the
> > > client, eg when it explicitly calls session.rollback() after your
> > > application code decides that its format is wrong.
> > >
> > > If that looks like it might be useful then I send a more complete
> > > example,
> > > i.e. including the specification of the alternate exchange.
> > >
> > > Phil
> > >
> > >
> > > On 7 November 2012 12:45, Gordon Sim <go...@gmail.com>
> > > wrote:
> > >
> > > > On 11/07/2012 12:11 PM, Jan Bares wrote:
> > > >
> > > >> we are planning to reject messages that do not satisfy message
> > > >> contract
> > > >> (e.g. message is of wrong format). The reject and DLQ seems to
> > > >> be the
> > > right
> > > >> solution for this problem.
> > > >>
> > > >
> > > > At present the only thing I can suggest is that you have the
> > > > client itself
> > > > send the 'rejected' message to the DLQ (or exchange or
> > > > whatever). You
> > > can
> > > > do this before acknowledging it to avoid losing it on failure
> > > > if that is
> > > > important.
> > > >
> > > > Longer term perhaps the JMS client could recognise a certain
> > > > category of
> > > > exception thrown by a MessageListener and interpret that as a
> > > > desire to
> > > > reject the message in question. Any thoughts on that from the
> > > > JMS devs?
> > > >
> > > >
> > > > ------------------------------**------------------------------**---------
> > > > To unsubscribe, e-mail:
> > > > users-unsubscribe@qpid.apache.**org<users-
> > > unsubscribe@qpid.apache.org>
> > > > For additional commands, e-mail: users-help@qpid.apache.org
> > > >
> > > >
> > 
> > 
> > 
> > 
> > DISCLAIMER
> > WOOD & Company Financial Services, a.s. and its branches are
> > authorized
> > and regulated by the CNB as Home State regulator and in Poland by
> > the KNF,
> > in Romania by the CNVM, in Slovakia by the NBS and in the UK by the
> > FSA as
> > Host State regulators.  For further information about WOOD & Co.,
> > its
> > investment services, financial instruments and associated risks,
> > safeguard
> > client assets (incl. compensation schemes) and contractual
> > relationship
> > please see our website at www.wood.cz under section Corporate
> > Governance.
> > 
> > Unless otherwise stated, this transmission is neither an offer nor
> > the
> > solicitation of an offer to sell or purchase any investment. All
> > estimates,
> > opinions and other information contained herein are subject to
> > change
> > without notice and are provided in good faith but without legal
> > responsibility
> > or liability. Opinion may be personal to the author and may not
> > reflect the
> > opinions of WOOD & Co. Communications from sales persons, sales
> > traders
> > or traders should not be regarded as investment research and may
> > contain
> > opinions or trading ideas which are different from WOOD & Co.
> > investment
> > research opinions.
> > 
> > This e-mail and any attachments are confidential and may be
> > privileged or
> > otherwise protected from disclosure. If you are not a named
> > addressee you
> > must not use, disclose, distribute, copy, print or rely on this
> > e-mail and any of
> > its attachments. Please notify the sender that you have received
> > this email
> > by mistake by replying to the email, and then delete the email and
> > any copies
> > of it. Although WOOD & Co. routinely screens e-mails for viruses,
> > addressees
> > should scan this e-mail and any attachments for viruses. WOOD & Co.
> > makes
> > no representation or warranty as to the absence of viruses in this
> > e-mail or
> > any attachments. Please note that to ensure regulatory compliance
> > and for
> > the protection of our clients and business, we may monitor and read
> > e-mails
> > sent to and from our server(s).
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> > For additional commands, e-mail: users-help@qpid.apache.org
> 
> 
> 
> 
> 
> DISCLAIMER
> WOOD & Company Financial Services, a.s. and its branches are
> authorized and regulated by the CNB as Home State regulator and in
> Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS
> and in the UK by the FSA as Host State regulators.  For further
> information about WOOD & Co., its investment services, financial
> instruments and associated risks, safeguard client assets (incl.
> compensation schemes) and contractual relationship please see our
> website at www.wood.cz under section Corporate Governance.
> 
> Unless otherwise stated, this transmission is neither an offer nor
> the solicitation of an offer to sell or purchase any investment. All
> estimates, opinions and other information contained herein are
> subject to change without notice and are provided in good faith but
> without legal responsibility or liability. Opinion may be personal
> to the author and may not reflect the opinions of WOOD & Co.
> Communications from sales persons, sales traders or traders should
> not be regarded as investment research and may contain opinions or
> trading ideas which are different from WOOD & Co. investment
>  research opinions.
> 
> This e-mail and any attachments are confidential and may be
> privileged or otherwise protected from disclosure. If you are not a
> named addressee you must not use, disclose, distribute, copy, print
> or rely on this e-mail and any of its attachments. Please notify the
> sender that you have received this email by mistake by replying to
> the email, and then delete the email and any copies of it. Although
> WOOD & Co. routinely screens e-mails for viruses, addressees should
> scan this e-mail and any attachments for viruses. WOOD & Co. makes
> no representation or warranty as to the absence of viruses in this
> e-mail or any attachments. Please note that to ensure regulatory
> compliance and for the protection of our clients and business, we
> may monitor and read e-mails sent to and from our server(s).
> 
> 
> 
> ---------------------------------------------------------------------
> 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


RE: Java client and message release or reject

Posted by Jan Bares <ja...@wood.cz>.
Does the Java client support message reject? I am not speaking about JMS API, but it seems that even internally there is no support for reject, just release (and redeliver). Can someone confirm that please?

Thanks, Jan

> -----Original Message-----
> From: Jan Bares [mailto:jan.bares@wood.cz]
> Sent: Thursday, November 08, 2012 9:41 AM
> To: users@qpid.apache.org
> Subject: RE: Java client and message release or reject
> 
> Hi Phil,
> 
> I ommitted this in my question, I am using C++ broker.
> 
> Currenlty I am testing a hack - casting JMS object to the underlying QPID
> imlementing classes and using whats available there. If anybody did that
> before me, let me know if it worked. And yes, I know its not portable and
> even may not work after upgrade but I can live with that.
> 
> Regards, Jan
> 
> > -----Original Message-----
> > From: philharveyonline@googlemail.com
> > [mailto:philharveyonline@googlemail.com] On Behalf Of Phil Harvey
> > Sent: Thursday, November 08, 2012 9:31 AM
> > To: users@qpid.apache.org
> > Subject: Re: Java client and message release or reject
> >
> > Jan,
> >
> > I'm not sure which broker you're using.  If you're using the Java Broker,
> > note that you can configure it to send messages to the dead letter queue
> > after N attempts with this sort of thing in your virtualhosts.xml:
> >
> >     ...
> >     <queues>
> >         <maximumDeliveryCount>1</maximumDeliveryCount>
> >         ...
> >
> > The delivery count is incremented each time the message is rejected by
> the
> > client, eg when it explicitly calls session.rollback() after your
> > application code decides that its format is wrong.
> >
> > If that looks like it might be useful then I send a more complete example,
> > i.e. including the specification of the alternate exchange.
> >
> > Phil
> >
> >
> > On 7 November 2012 12:45, Gordon Sim <go...@gmail.com> wrote:
> >
> > > On 11/07/2012 12:11 PM, Jan Bares wrote:
> > >
> > >> we are planning to reject messages that do not satisfy message contract
> > >> (e.g. message is of wrong format). The reject and DLQ seems to be the
> > right
> > >> solution for this problem.
> > >>
> > >
> > > At present the only thing I can suggest is that you have the client itself
> > > send the 'rejected' message to the DLQ (or exchange or whatever). You
> > can
> > > do this before acknowledging it to avoid losing it on failure if that is
> > > important.
> > >
> > > Longer term perhaps the JMS client could recognise a certain category of
> > > exception thrown by a MessageListener and interpret that as a desire to
> > > reject the message in question. Any thoughts on that from the JMS devs?
> > >
> > >
> > > ------------------------------**------------------------------**---------
> > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<users-
> > unsubscribe@qpid.apache.org>
> > > For additional commands, e-mail: users-help@qpid.apache.org
> > >
> > >
> 
> 
> 
> 
> DISCLAIMER
> WOOD & Company Financial Services, a.s. and its branches are authorized
> and regulated by the CNB as Home State regulator and in Poland by the KNF,
> in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as
> Host State regulators.  For further information about WOOD & Co., its
> investment services, financial instruments and associated risks, safeguard
> client assets (incl. compensation schemes) and contractual relationship
> please see our website at www.wood.cz under section Corporate
> Governance.
> 
> Unless otherwise stated, this transmission is neither an offer nor the
> solicitation of an offer to sell or purchase any investment. All estimates,
> opinions and other information contained herein are subject to change
> without notice and are provided in good faith but without legal responsibility
> or liability. Opinion may be personal to the author and may not reflect the
> opinions of WOOD & Co. Communications from sales persons, sales traders
> or traders should not be regarded as investment research and may contain
> opinions or trading ideas which are different from WOOD & Co. investment
> research opinions.
> 
> This e-mail and any attachments are confidential and may be privileged or
> otherwise protected from disclosure. If you are not a named addressee you
> must not use, disclose, distribute, copy, print or rely on this e-mail and any of
> its attachments. Please notify the sender that you have received this email
> by mistake by replying to the email, and then delete the email and any copies
> of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees
> should scan this e-mail and any attachments for viruses. WOOD & Co. makes
> no representation or warranty as to the absence of viruses in this e-mail or
> any attachments. Please note that to ensure regulatory compliance and for
> the protection of our clients and business, we may monitor and read e-mails
> sent to and from our server(s).
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org





DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as Host State regulators.  For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.cz under section Corporate Governance. 

Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment  research opinions. 

This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


RE: Java client and message release or reject

Posted by Jan Bares <ja...@wood.cz>.
Hi Phil,

I ommitted this in my question, I am using C++ broker. 

Currenlty I am testing a hack - casting JMS object to the underlying QPID imlementing classes and using whats available there. If anybody did that before me, let me know if it worked. And yes, I know its not portable and even may not work after upgrade but I can live with that.

Regards, Jan

> -----Original Message-----
> From: philharveyonline@googlemail.com
> [mailto:philharveyonline@googlemail.com] On Behalf Of Phil Harvey
> Sent: Thursday, November 08, 2012 9:31 AM
> To: users@qpid.apache.org
> Subject: Re: Java client and message release or reject
> 
> Jan,
> 
> I'm not sure which broker you're using.  If you're using the Java Broker,
> note that you can configure it to send messages to the dead letter queue
> after N attempts with this sort of thing in your virtualhosts.xml:
> 
>     ...
>     <queues>
>         <maximumDeliveryCount>1</maximumDeliveryCount>
>         ...
> 
> The delivery count is incremented each time the message is rejected by the
> client, eg when it explicitly calls session.rollback() after your
> application code decides that its format is wrong.
> 
> If that looks like it might be useful then I send a more complete example,
> i.e. including the specification of the alternate exchange.
> 
> Phil
> 
> 
> On 7 November 2012 12:45, Gordon Sim <go...@gmail.com> wrote:
> 
> > On 11/07/2012 12:11 PM, Jan Bares wrote:
> >
> >> we are planning to reject messages that do not satisfy message contract
> >> (e.g. message is of wrong format). The reject and DLQ seems to be the
> right
> >> solution for this problem.
> >>
> >
> > At present the only thing I can suggest is that you have the client itself
> > send the 'rejected' message to the DLQ (or exchange or whatever). You
> can
> > do this before acknowledging it to avoid losing it on failure if that is
> > important.
> >
> > Longer term perhaps the JMS client could recognise a certain category of
> > exception thrown by a MessageListener and interpret that as a desire to
> > reject the message in question. Any thoughts on that from the JMS devs?
> >
> >
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<users-
> unsubscribe@qpid.apache.org>
> > For additional commands, e-mail: users-help@qpid.apache.org
> >
> >




DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as Host State regulators.  For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.cz under section Corporate Governance. 

Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment  research opinions. 

This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Java client and message release or reject

Posted by Phil Harvey <ph...@philharveyonline.com>.
Hi Gordon,

Yes, you're right - jmsSession.rollback() does result in an AMQP
message.release command.

Phil


On 8 November 2012 08:44, Gordon Sim <go...@gmail.com> wrote:

> On 11/08/2012 08:30 AM, Phil Harvey wrote:
>
>> The delivery count is incremented each time the message is rejected by the
>> client, eg when it explicitly calls session.rollback() after your
>> application code decides that its format is wrong.
>>
>
> Does that actually reject (in 0-10 parlance) or just release the
> message(s) (from my cursory examination of the code it seemed like it was
> the latter).
>
> Of course, if the broker provides the means to handle that as desired, the
> difference need not be relevant. However if the dead-lettering is based on
> delivery count and the message can only be delivered once, then is it not
> the case that a failure might also result in dead-lettering of in-doubt
> messages?
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<us...@qpid.apache.org>
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: Java client and message release or reject

Posted by Gordon Sim <go...@gmail.com>.
On 11/08/2012 08:30 AM, Phil Harvey wrote:
> The delivery count is incremented each time the message is rejected by the
> client, eg when it explicitly calls session.rollback() after your
> application code decides that its format is wrong.

Does that actually reject (in 0-10 parlance) or just release the 
message(s) (from my cursory examination of the code it seemed like it 
was the latter).

Of course, if the broker provides the means to handle that as desired, 
the difference need not be relevant. However if the dead-lettering is 
based on delivery count and the message can only be delivered once, then 
is it not the case that a failure might also result in dead-lettering of 
in-doubt messages?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Java client and message release or reject

Posted by Phil Harvey <ph...@philharveyonline.com>.
Jan,

I'm not sure which broker you're using.  If you're using the Java Broker,
note that you can configure it to send messages to the dead letter queue
after N attempts with this sort of thing in your virtualhosts.xml:

    ...
    <queues>
        <maximumDeliveryCount>1</maximumDeliveryCount>
        ...

The delivery count is incremented each time the message is rejected by the
client, eg when it explicitly calls session.rollback() after your
application code decides that its format is wrong.

If that looks like it might be useful then I send a more complete example,
i.e. including the specification of the alternate exchange.

Phil


On 7 November 2012 12:45, Gordon Sim <go...@gmail.com> wrote:

> On 11/07/2012 12:11 PM, Jan Bares wrote:
>
>> we are planning to reject messages that do not satisfy message contract
>> (e.g. message is of wrong format). The reject and DLQ seems to be the right
>> solution for this problem.
>>
>
> At present the only thing I can suggest is that you have the client itself
> send the 'rejected' message to the DLQ (or exchange or whatever). You can
> do this before acknowledging it to avoid losing it on failure if that is
> important.
>
> Longer term perhaps the JMS client could recognise a certain category of
> exception thrown by a MessageListener and interpret that as a desire to
> reject the message in question. Any thoughts on that from the JMS devs?
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<us...@qpid.apache.org>
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: Java client and message release or reject

Posted by Gordon Sim <go...@gmail.com>.
On 11/07/2012 12:11 PM, Jan Bares wrote:
> we are planning to reject messages that do not satisfy message contract (e.g. message is of wrong format). The reject and DLQ seems to be the right solution for this problem.

At present the only thing I can suggest is that you have the client 
itself send the 'rejected' message to the DLQ (or exchange or whatever). 
You can do this before acknowledging it to avoid losing it on failure if 
that is important.

Longer term perhaps the JMS client could recognise a certain category of 
exception thrown by a MessageListener and interpret that as a desire to 
reject the message in question. Any thoughts on that from the JMS devs?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


RE: Java client and message release or reject

Posted by Jan Bares <ja...@wood.cz>.
Thanks Gordon,

we are planning to reject messages that do not satisfy message contract (e.g. message is of wrong format). The reject and DLQ seems to be the right solution for this problem.

Jan

> -----Original Message-----
> From: Gordon Sim [mailto:gordon.r.sim@gmail.com]
> Sent: Wednesday, November 07, 2012 11:53 AM
> To: users@qpid.apache.org
> Subject: Re: Java client and message release or reject
> 
> On 11/07/2012 09:09 AM, Jan Bares wrote:
> > how can I release or reject a message in Java client? JMS API has no
> methods like that. What is the suggested method?
> 
> What is/(are) the use case(s) where you need to explicitly release or
> reject? Knowing that may help provide a better answer.
> 
> The Qpid C++ broker doesn't do anything special for reject (if an
> alternate-exchange has been configure for the queue the rejected message
> gets routed to that, else it gets dropped). Depending on what you expect
> to happen you may get away with simply dropping any messages you might
> wish to reject.
> 
> Most use cases for release should be handled by the client itself.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org





DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as Host State regulators.  For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.cz under section Corporate Governance. 

Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment  research opinions. 

This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Java client and message release or reject

Posted by Gordon Sim <go...@gmail.com>.
On 11/07/2012 09:09 AM, Jan Bares wrote:
> how can I release or reject a message in Java client? JMS API has no methods like that. What is the suggested method?

What is/(are) the use case(s) where you need to explicitly release or 
reject? Knowing that may help provide a better answer.

The Qpid C++ broker doesn't do anything special for reject (if an 
alternate-exchange has been configure for the queue the rejected message 
gets routed to that, else it gets dropped). Depending on what you expect 
to happen you may get away with simply dropping any messages you might 
wish to reject.

Most use cases for release should be handled by the client itself.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org