Consuming multiple JMS messages in one single transaction

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Consuming multiple JMS messages in one single transaction

Thomas Johansen
Hi,

How can I consume multiple JMS messages in one single transaction with
Camel? Is it even possible?

from("jms:myqueue").transacted().to("something") will create a transaction
per consumed message, which is not what I want.

I actually want to consume X messages, aggregate them to a report and then
produce that report to the same JMS resource...

Takk,
Thomas
Reply | Threaded
Open this post in threaded view
|

Re: Consuming multiple JMS messages in one single transaction

Claus Ibsen-2
Hi

The camel-jms components uses Spring DMLC for consuming messages.
And its not designed for batched transactions in mind.
And therefore this is not supported in Camel out of the box.

You would need to use the JMS API for that.




On Sat, Apr 14, 2012 at 2:20 PM, Thomas Johansen <[hidden email]> wrote:

> Hi,
>
> How can I consume multiple JMS messages in one single transaction with
> Camel? Is it even possible?
>
> from("jms:myqueue").transacted().to("something") will create a transaction
> per consumed message, which is not what I want.
>
> I actually want to consume X messages, aggregate them to a report and then
> produce that report to the same JMS resource...
>
> Takk,
> Thomas



--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Reply | Threaded
Open this post in threaded view
|

Re: Consuming multiple JMS messages in one single transaction

bacar
Hi,
I need to do something very similar to this request from April 2012, ie consume multiple JMS messages in a single transaction. Is the advice still current?

Does the same also apply for the opposite, ie consuming a single message in a transaction, and then writing multiple output messages in one transaction?

I guess it would be possible to write our own JmsComponent alternative that supports such functionality and allows us to continue using camel, but I imagine that without dedicated support from Spring, it might be quite a lot of effort.
Reply | Threaded
Open this post in threaded view
|

Re: Consuming multiple JMS messages in one single transaction

Bengt Rodehav
What about using the "sjms" component instead of the "jms" component. The
documentation says it supports "Transacted Batch Consumers & Producers". I
haven't used this feature myself but I have just started to use the sjms
component since I prefer not using Spring.

/Bengt


2013/9/24 bacar <[hidden email]>

> Hi,
> I need to do something very similar to this request from April 2012, ie
> consume multiple JMS messages in a single transaction. Is the advice still
> current?
>
> Does the same also apply for the opposite, ie consuming a single message in
> a transaction, and then writing multiple output messages in one
> transaction?
>
> I guess it would be possible to write our own JmsComponent alternative that
> supports such functionality and allows us to continue using camel, but I
> imagine that without dedicated support from Spring, it might be quite a lot
> of effort.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5740169.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Consuming multiple JMS messages in one single transaction

bacar
Thanks - I'll try that!
Reply | Threaded
Open this post in threaded view
|

RE: Consuming multiple JMS messages in one single transaction

ravi.puli
In reply to this post by Bengt Rodehav
Hi,

If I understand correctly, it looks like sjms is not to read multiple messages but read a single BatchMessage which is an ArrayList of messages.

Do we have any solution to consume multiple (chunk) JMS messages in a single transaction?

Regards
RK


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Bengt Rodehav
Sent: 26 September 2013 15:01
To: [hidden email]
Subject: Re: Consuming multiple JMS messages in one single transaction

What about using the "sjms" component instead of the "jms" component. The
documentation says it supports "Transacted Batch Consumers & Producers". I
haven't used this feature myself but I have just started to use the sjms
component since I prefer not using Spring.

/Bengt


2013/9/24 bacar <[hidden email]>

> Hi,
> I need to do something very similar to this request from April 2012, ie
> consume multiple JMS messages in a single transaction. Is the advice still
> current?
>
> Does the same also apply for the opposite, ie consuming a single message in
> a transaction, and then writing multiple output messages in one
> transaction?
>
> I guess it would be possible to write our own JmsComponent alternative that
> supports such functionality and allows us to continue using camel, but I
> imagine that without dedicated support from Spring, it might be quite a lot
> of effort.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5740169.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
_______________________________________________

This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer.

For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com.

_______________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Consuming multiple JMS messages in one single transaction

sully6768
Hi RK,

SJMS batch transaction consumes messages individually and does not use or
produce a List.  If you wanted that result you would need to couple the
SJMS transacted consumer with an aggregator.

That said, there is a bug in this pattern where a race condition is
introduced given the batch transaction can close before the aggregator
completes.  I am still working on this issue but hope to have a proper
solution soon.

The BatchMessage class is for the producer endpoint given you need to be
able to able to track the messages as a whole if there is a failure with
the producer.

Thanks,
Scott ES


On Thu, Jan 16, 2014 at 4:01 PM, <[hidden email]> wrote:

> Hi,
>
> If I understand correctly, it looks like sjms is not to read multiple
> messages but read a single BatchMessage which is an ArrayList of messages.
>
> Do we have any solution to consume multiple (chunk) JMS messages in a
> single transaction?
>
> Regards
> RK
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Bengt Rodehav
> Sent: 26 September 2013 15:01
> To: [hidden email]
> Subject: Re: Consuming multiple JMS messages in one single transaction
>
> What about using the "sjms" component instead of the "jms" component. The
> documentation says it supports "Transacted Batch Consumers & Producers". I
> haven't used this feature myself but I have just started to use the sjms
> component since I prefer not using Spring.
>
> /Bengt
>
>
> 2013/9/24 bacar <[hidden email]>
>
> > Hi,
> > I need to do something very similar to this request from April 2012, ie
> > consume multiple JMS messages in a single transaction. Is the advice
> still
> > current?
> >
> > Does the same also apply for the opposite, ie consuming a single message
> in
> > a transaction, and then writing multiple output messages in one
> > transaction?
> >
> > I guess it would be possible to write our own JmsComponent alternative
> that
> > supports such functionality and allows us to continue using camel, but I
> > imagine that without dedicated support from Spring, it might be quite a
> lot
> > of effort.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5740169.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
> _______________________________________________
>
> This message is for information purposes only, it is not a recommendation,
> advice, offer or solicitation to buy or sell a product or service nor an
> official confirmation of any transaction. It is directed at persons who are
> professionals and is not intended for retail customer use. Intended for
> recipient only. This message is subject to the terms at:
> www.barclays.com/emaildisclaimer.
>
> For important disclosures, please see:
> www.barclays.com/salesandtradingdisclaimer regarding market commentary
> from Barclays Sales and/or Trading, who are active market participants; and
> in respect of Barclays Research, including disclosures relating to specific
> issuers, please see http://publicresearch.barclays.com.
>
> _______________________________________________
>



--
--
Scott England-Sullivan
Apache Camel Committer
Principal Consultant / Sr. Architect | Red Hat, Inc.
FuseSource is now part of Red Hat
Web:     fusesource.com <http://www.fusesource.com> |
redhat.com<http://www.redhat.com>
Blog:     sully6768.blogspot.com
Twitter: sully6768
--
Scott England-Sullivan
----------------------------------
FuseSource
Web:     http://www.fusesource.com
Blog:     http://sully6768.blogspot.com
Twitter: sully6768
Reply | Threaded
Open this post in threaded view
|

Re: Consuming multiple JMS messages in one single transaction

bacar
So, does that mean there is no solution for consuming multiple JMS messages in a single transaction? Such that transactionality is correctly respected, ie if something goes wrong with the Nth such message the whole batch is rolled back.

Ideally without the need to use a transactional aggregator to it into a persistent store. I don't have much interest in configuring a local storage DB, just want to process the batch of messages and then move on (or roll back). 

Sent from Mailbox for iPhone


On Fri, Jan 24, 2014 at 3:38 PM, sully6768 [via Camel] <[hidden email]> wrote:

Hi RK,

SJMS batch transaction consumes messages individually and does not use or
produce a List.  If you wanted that result you would need to couple the
SJMS transacted consumer with an aggregator.

That said, there is a bug in this pattern where a race condition is
introduced given the batch transaction can close before the aggregator
completes.  I am still working on this issue but hope to have a proper
solution soon.

The BatchMessage class is for the producer endpoint given you need to be
able to able to track the messages as a whole if there is a failure with
the producer.

Thanks,
Scott ES


On Thu, Jan 16, 2014 at 4:01 PM, <[hidden email]> wrote:


> Hi,
>
> If I understand correctly, it looks like sjms is not to read multiple
> messages but read a single BatchMessage which is an ArrayList of messages.
>
> Do we have any solution to consume multiple (chunk) JMS messages in a
> single transaction?
>
> Regards
> RK
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Bengt Rodehav
> Sent: 26 September 2013 15:01
> To: [hidden email]
> Subject: Re: Consuming multiple JMS messages in one single transaction
>
> What about using the "sjms" component instead of the "jms" component. The
> documentation says it supports "Transacted Batch Consumers & Producers". I
> haven't used this feature myself but I have just started to use the sjms
> component since I prefer not using Spring.
>
> /Bengt
>
>
> 2013/9/24 bacar <[hidden email]>
>
> > Hi,
> > I need to do something very similar to this request from April 2012, ie
> > consume multiple JMS messages in a single transaction. Is the advice
> still
> > current?
> >
> > Does the same also apply for the opposite, ie consuming a single message
> in
> > a transaction, and then writing multiple output messages in one
> > transaction?
> >
> > I guess it would be possible to write our own JmsComponent alternative
> that
> > supports such functionality and allows us to continue using camel, but I
> > imagine that without dedicated support from Spring, it might be quite a
> lot
> > of effort.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5740169.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
> _______________________________________________
>
> This message is for information purposes only, it is not a recommendation,
> advice, offer or solicitation to buy or sell a product or service nor an
> official confirmation of any transaction. It is directed at persons who are
> professionals and is not intended for retail customer use. Intended for
> recipient only. This message is subject to the terms at:
> www.barclays.com/emaildisclaimer.
>
> For important disclosures, please see:
> www.barclays.com/salesandtradingdisclaimer regarding market commentary
> from Barclays Sales and/or Trading, who are active market participants; and
> in respect of Barclays Research, including disclosures relating to specific
> issuers, please see http://publicresearch.barclays.com.
>
> _______________________________________________
>


--
--
Scott England-Sullivan
Apache Camel Committer
Principal Consultant / Sr. Architect | Red Hat, Inc.
FuseSource is now part of Red Hat
Web:     fusesource.com <http://www.fusesource.com> |
redhat.com<http://www.redhat.com>
Blog:     sully6768.blogspot.com
Twitter: sully6768
--
Scott England-Sullivan
----------------------------------
FuseSource
Web:     http://www.fusesource.com
Blog:     http://sully6768.blogspot.com
Twitter: sully6768



If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5746450.html
To unsubscribe from Consuming multiple JMS messages in one single transaction, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Consuming multiple JMS messages in one single transaction

sully6768
If you don't need an aggregator then you are good to go with SJMS for batch
consumers.  It is only in the case of an aggregator that there can be an
issue where the transaction can close before the aggregator completes.

Let me know if you need anything else.

Thanks,
Scott ES


On Fri, Jan 24, 2014 at 1:37 PM, bacar <[hidden email]> wrote:

> So, does that mean there is no solution for consuming multiple JMS
> messages in a single transaction? Such that transactionality is correctly
> respected, ie if something goes wrong with the Nth such message the whole
> batch is rolled back.
>
>
> Ideally without the need to use a transactional aggregator to it into a
> persistent store. I don't have much interest in configuring a local storage
> DB, just want to process the batch of messages and then move on (or roll
> back).
> --
> Sent from Mailbox for iPhone
>
> On Fri, Jan 24, 2014 at 3:38 PM, sully6768 [via Camel]
> <[hidden email]> wrote:
>
> > Hi RK,
> > SJMS batch transaction consumes messages individually and does not use or
> > produce a List.  If you wanted that result you would need to couple the
> > SJMS transacted consumer with an aggregator.
> > That said, there is a bug in this pattern where a race condition is
> > introduced given the batch transaction can close before the aggregator
> > completes.  I am still working on this issue but hope to have a proper
> > solution soon.
> > The BatchMessage class is for the producer endpoint given you need to be
> > able to able to track the messages as a whole if there is a failure with
> > the producer.
> > Thanks,
> > Scott ES
> > On Thu, Jan 16, 2014 at 4:01 PM, <[hidden email]> wrote:
> >> Hi,
> >>
> >> If I understand correctly, it looks like sjms is not to read multiple
> >> messages but read a single BatchMessage which is an ArrayList of
> messages.
> >>
> >> Do we have any solution to consume multiple (chunk) JMS messages in a
> >> single transaction?
> >>
> >> Regards
> >> RK
> >>
> >>
> >> -----Original Message-----
> >> From: [hidden email] [mailto:[hidden email]] On
> Behalf
> >> Of Bengt Rodehav
> >> Sent: 26 September 2013 15:01
> >> To: [hidden email]
> >> Subject: Re: Consuming multiple JMS messages in one single transaction
> >>
> >> What about using the "sjms" component instead of the "jms" component.
> The
> >> documentation says it supports "Transacted Batch Consumers &
> Producers". I
> >> haven't used this feature myself but I have just started to use the sjms
> >> component since I prefer not using Spring.
> >>
> >> /Bengt
> >>
> >>
> >> 2013/9/24 bacar <[hidden email]>
> >>
> >> > Hi,
> >> > I need to do something very similar to this request from April 2012,
> ie
> >> > consume multiple JMS messages in a single transaction. Is the advice
> >> still
> >> > current?
> >> >
> >> > Does the same also apply for the opposite, ie consuming a single
> message
> >> in
> >> > a transaction, and then writing multiple output messages in one
> >> > transaction?
> >> >
> >> > I guess it would be possible to write our own JmsComponent alternative
> >> that
> >> > supports such functionality and allows us to continue using camel,
> but I
> >> > imagine that without dedicated support from Spring, it might be quite
> a
> >> lot
> >> > of effort.
> >> >
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >> >
> >>
> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5740169.html
> >> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >> >
> >> _______________________________________________
> >>
> >> This message is for information purposes only, it is not a
> recommendation,
> >> advice, offer or solicitation to buy or sell a product or service nor an
> >> official confirmation of any transaction. It is directed at persons who
> are
> >> professionals and is not intended for retail customer use. Intended for
> >> recipient only. This message is subject to the terms at:
> >> www.barclays.com/emaildisclaimer.
> >>
> >> For important disclosures, please see:
> >> www.barclays.com/salesandtradingdisclaimer regarding market commentary
> >> from Barclays Sales and/or Trading, who are active market participants;
> and
> >> in respect of Barclays Research, including disclosures relating to
> specific
> >> issuers, please see http://publicresearch.barclays.com.
> >>
> >> _______________________________________________
> >>
> > --
> > --
> > Scott England-Sullivan
> > Apache Camel Committer
> > Principal Consultant / Sr. Architect | Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Web:     fusesource.com <http://www.fusesource.com> |
> > redhat.com<http://www.redhat.com>
> > Blog:     sully6768.blogspot.com
> > Twitter: sully6768
> > -----
> > --
> > Scott England-Sullivan
> > ----------------------------------
> > FuseSource
> > Web:     http://www.fusesource.com
> > Blog:     http://sully6768.blogspot.com
> > Twitter: sully6768
> > _______________________________________________
> > If you reply to this email, your message will be added to the discussion
> below:
> >
> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5746450.html
> > To unsubscribe from Consuming multiple JMS messages in one single
> transaction, visit
>
>
>
> --
> View this message in context:
>
http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5746460.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
--
Scott England-Sullivan
Apache Camel Committer
Principal Consultant / Sr. Architect | Red Hat, Inc.
FuseSource is now part of Red Hat
Web:     fusesource.com <http://www.fusesource.com> |
redhat.com<http://www.redhat.com>
Blog:     sully6768.blogspot.com
Twitter: sully6768
--
Scott England-Sullivan
----------------------------------
FuseSource
Web:     http://www.fusesource.com
Blog:     http://sully6768.blogspot.com
Twitter: sully6768
Reply | Threaded
Open this post in threaded view
|

Re: Consuming multiple JMS messages in one single transaction

kraythe
This question gets asked enough that perhaps there should be some text
added to the JMS documentation on the matter.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Fri, Jan 31, 2014 at 8:00 AM, Scott England-Sullivan <[hidden email]
> wrote:

> If you don't need an aggregator then you are good to go with SJMS for batch
> consumers.  It is only in the case of an aggregator that there can be an
> issue where the transaction can close before the aggregator completes.
>
> Let me know if you need anything else.
>
> Thanks,
> Scott ES
>
>
> On Fri, Jan 24, 2014 at 1:37 PM, bacar <[hidden email]> wrote:
>
> > So, does that mean there is no solution for consuming multiple JMS
> > messages in a single transaction? Such that transactionality is correctly
> > respected, ie if something goes wrong with the Nth such message the whole
> > batch is rolled back.
> >
> >
> > Ideally without the need to use a transactional aggregator to it into a
> > persistent store. I don't have much interest in configuring a local
> storage
> > DB, just want to process the batch of messages and then move on (or roll
> > back).
> > --
> > Sent from Mailbox for iPhone
> >
> > On Fri, Jan 24, 2014 at 3:38 PM, sully6768 [via Camel]
> > <[hidden email]> wrote:
> >
> > > Hi RK,
> > > SJMS batch transaction consumes messages individually and does not use
> or
> > > produce a List.  If you wanted that result you would need to couple the
> > > SJMS transacted consumer with an aggregator.
> > > That said, there is a bug in this pattern where a race condition is
> > > introduced given the batch transaction can close before the aggregator
> > > completes.  I am still working on this issue but hope to have a proper
> > > solution soon.
> > > The BatchMessage class is for the producer endpoint given you need to
> be
> > > able to able to track the messages as a whole if there is a failure
> with
> > > the producer.
> > > Thanks,
> > > Scott ES
> > > On Thu, Jan 16, 2014 at 4:01 PM, <[hidden email]> wrote:
> > >> Hi,
> > >>
> > >> If I understand correctly, it looks like sjms is not to read multiple
> > >> messages but read a single BatchMessage which is an ArrayList of
> > messages.
> > >>
> > >> Do we have any solution to consume multiple (chunk) JMS messages in a
> > >> single transaction?
> > >>
> > >> Regards
> > >> RK
> > >>
> > >>
> > >> -----Original Message-----
> > >> From: [hidden email] [mailto:[hidden email]] On
> > Behalf
> > >> Of Bengt Rodehav
> > >> Sent: 26 September 2013 15:01
> > >> To: [hidden email]
> > >> Subject: Re: Consuming multiple JMS messages in one single transaction
> > >>
> > >> What about using the "sjms" component instead of the "jms" component.
> > The
> > >> documentation says it supports "Transacted Batch Consumers &
> > Producers". I
> > >> haven't used this feature myself but I have just started to use the
> sjms
> > >> component since I prefer not using Spring.
> > >>
> > >> /Bengt
> > >>
> > >>
> > >> 2013/9/24 bacar <[hidden email]>
> > >>
> > >> > Hi,
> > >> > I need to do something very similar to this request from April 2012,
> > ie
> > >> > consume multiple JMS messages in a single transaction. Is the advice
> > >> still
> > >> > current?
> > >> >
> > >> > Does the same also apply for the opposite, ie consuming a single
> > message
> > >> in
> > >> > a transaction, and then writing multiple output messages in one
> > >> > transaction?
> > >> >
> > >> > I guess it would be possible to write our own JmsComponent
> alternative
> > >> that
> > >> > supports such functionality and allows us to continue using camel,
> > but I
> > >> > imagine that without dedicated support from Spring, it might be
> quite
> > a
> > >> lot
> > >> > of effort.
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > View this message in context:
> > >> >
> > >>
> >
> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5740169.html
> > >> > Sent from the Camel - Users mailing list archive at Nabble.com.
> > >> >
> > >> _______________________________________________
> > >>
> > >> This message is for information purposes only, it is not a
> > recommendation,
> > >> advice, offer or solicitation to buy or sell a product or service nor
> an
> > >> official confirmation of any transaction. It is directed at persons
> who
> > are
> > >> professionals and is not intended for retail customer use. Intended
> for
> > >> recipient only. This message is subject to the terms at:
> > >> www.barclays.com/emaildisclaimer.
> > >>
> > >> For important disclosures, please see:
> > >> www.barclays.com/salesandtradingdisclaimer regarding market
> commentary
> > >> from Barclays Sales and/or Trading, who are active market
> participants;
> > and
> > >> in respect of Barclays Research, including disclosures relating to
> > specific
> > >> issuers, please see http://publicresearch.barclays.com.
> > >>
> > >> _______________________________________________
> > >>
> > > --
> > > --
> > > Scott England-Sullivan
> > > Apache Camel Committer
> > > Principal Consultant / Sr. Architect | Red Hat, Inc.
> > > FuseSource is now part of Red Hat
> > > Web:     fusesource.com <http://www.fusesource.com> |
> > > redhat.com<http://www.redhat.com>
> > > Blog:     sully6768.blogspot.com
> > > Twitter: sully6768
> > > -----
> > > --
> > > Scott England-Sullivan
> > > ----------------------------------
> > > FuseSource
> > > Web:     http://www.fusesource.com
> > > Blog:     http://sully6768.blogspot.com
> > > Twitter: sully6768
> > > _______________________________________________
> > > If you reply to this email, your message will be added to the
> discussion
> > below:
> > >
> >
> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5746450.html
> > > To unsubscribe from Consuming multiple JMS messages in one single
> > transaction, visit
> >
> >
> >
> >
> > --
> > View this message in context:
> >
>
http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5746460.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
>
> --
> --
> Scott England-Sullivan
> Apache Camel Committer
> Principal Consultant / Sr. Architect | Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web:     fusesource.com <http://www.fusesource.com> |
> redhat.com<http://www.redhat.com>
> Blog:     sully6768.blogspot.com
> Twitter: sully6768
>
Reply | Threaded
Open this post in threaded view
|

Re: Consuming multiple JMS messages in one single transaction

Claus Ibsen-2
On Sun, Feb 2, 2014 at 7:11 AM, kraythe . <[hidden email]> wrote:
> This question gets asked enough that perhaps there should be some text
> added to the JMS documentation on the matter.
>

Yeah sure we love when people contribute and help improve the docs.
http://camel.apache.org/contributing


> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
> <http://www.linkedin.com/pub/robert-simmons/40/852/a39>*
>
>
> On Fri, Jan 31, 2014 at 8:00 AM, Scott England-Sullivan <[hidden email]
>> wrote:
>
>> If you don't need an aggregator then you are good to go with SJMS for batch
>> consumers.  It is only in the case of an aggregator that there can be an
>> issue where the transaction can close before the aggregator completes.
>>
>> Let me know if you need anything else.
>>
>> Thanks,
>> Scott ES
>>
>>
>> On Fri, Jan 24, 2014 at 1:37 PM, bacar <[hidden email]> wrote:
>>
>> > So, does that mean there is no solution for consuming multiple JMS
>> > messages in a single transaction? Such that transactionality is correctly
>> > respected, ie if something goes wrong with the Nth such message the whole
>> > batch is rolled back.
>> >
>> >
>> > Ideally without the need to use a transactional aggregator to it into a
>> > persistent store. I don't have much interest in configuring a local
>> storage
>> > DB, just want to process the batch of messages and then move on (or roll
>> > back).
>> > --
>> > Sent from Mailbox for iPhone
>> >
>> > On Fri, Jan 24, 2014 at 3:38 PM, sully6768 [via Camel]
>> > <[hidden email]> wrote:
>> >
>> > > Hi RK,
>> > > SJMS batch transaction consumes messages individually and does not use
>> or
>> > > produce a List.  If you wanted that result you would need to couple the
>> > > SJMS transacted consumer with an aggregator.
>> > > That said, there is a bug in this pattern where a race condition is
>> > > introduced given the batch transaction can close before the aggregator
>> > > completes.  I am still working on this issue but hope to have a proper
>> > > solution soon.
>> > > The BatchMessage class is for the producer endpoint given you need to
>> be
>> > > able to able to track the messages as a whole if there is a failure
>> with
>> > > the producer.
>> > > Thanks,
>> > > Scott ES
>> > > On Thu, Jan 16, 2014 at 4:01 PM, <[hidden email]> wrote:
>> > >> Hi,
>> > >>
>> > >> If I understand correctly, it looks like sjms is not to read multiple
>> > >> messages but read a single BatchMessage which is an ArrayList of
>> > messages.
>> > >>
>> > >> Do we have any solution to consume multiple (chunk) JMS messages in a
>> > >> single transaction?
>> > >>
>> > >> Regards
>> > >> RK
>> > >>
>> > >>
>> > >> -----Original Message-----
>> > >> From: [hidden email] [mailto:[hidden email]] On
>> > Behalf
>> > >> Of Bengt Rodehav
>> > >> Sent: 26 September 2013 15:01
>> > >> To: [hidden email]
>> > >> Subject: Re: Consuming multiple JMS messages in one single transaction
>> > >>
>> > >> What about using the "sjms" component instead of the "jms" component.
>> > The
>> > >> documentation says it supports "Transacted Batch Consumers &
>> > Producers". I
>> > >> haven't used this feature myself but I have just started to use the
>> sjms
>> > >> component since I prefer not using Spring.
>> > >>
>> > >> /Bengt
>> > >>
>> > >>
>> > >> 2013/9/24 bacar <[hidden email]>
>> > >>
>> > >> > Hi,
>> > >> > I need to do something very similar to this request from April 2012,
>> > ie
>> > >> > consume multiple JMS messages in a single transaction. Is the advice
>> > >> still
>> > >> > current?
>> > >> >
>> > >> > Does the same also apply for the opposite, ie consuming a single
>> > message
>> > >> in
>> > >> > a transaction, and then writing multiple output messages in one
>> > >> > transaction?
>> > >> >
>> > >> > I guess it would be possible to write our own JmsComponent
>> alternative
>> > >> that
>> > >> > supports such functionality and allows us to continue using camel,
>> > but I
>> > >> > imagine that without dedicated support from Spring, it might be
>> quite
>> > a
>> > >> lot
>> > >> > of effort.
>> > >> >
>> > >> >
>> > >> >
>> > >> > --
>> > >> > View this message in context:
>> > >> >
>> > >>
>> >
>> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5740169.html
>> > >> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> > >> >
>> > >> _______________________________________________
>> > >>
>> > >> This message is for information purposes only, it is not a
>> > recommendation,
>> > >> advice, offer or solicitation to buy or sell a product or service nor
>> an
>> > >> official confirmation of any transaction. It is directed at persons
>> who
>> > are
>> > >> professionals and is not intended for retail customer use. Intended
>> for
>> > >> recipient only. This message is subject to the terms at:
>> > >> www.barclays.com/emaildisclaimer.
>> > >>
>> > >> For important disclosures, please see:
>> > >> www.barclays.com/salesandtradingdisclaimer regarding market
>> commentary
>> > >> from Barclays Sales and/or Trading, who are active market
>> participants;
>> > and
>> > >> in respect of Barclays Research, including disclosures relating to
>> > specific
>> > >> issuers, please see http://publicresearch.barclays.com.
>> > >>
>> > >> _______________________________________________
>> > >>
>> > > --
>> > > --
>> > > Scott England-Sullivan
>> > > Apache Camel Committer
>> > > Principal Consultant / Sr. Architect | Red Hat, Inc.
>> > > FuseSource is now part of Red Hat
>> > > Web:     fusesource.com <http://www.fusesource.com> |
>> > > redhat.com<http://www.redhat.com>
>> > > Blog:     sully6768.blogspot.com
>> > > Twitter: sully6768
>> > > -----
>> > > --
>> > > Scott England-Sullivan
>> > > ----------------------------------
>> > > FuseSource
>> > > Web:     http://www.fusesource.com
>> > > Blog:     http://sully6768.blogspot.com
>> > > Twitter: sully6768
>> > > _______________________________________________
>> > > If you reply to this email, your message will be added to the
>> discussion
>> > below:
>> > >
>> >
>> http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5746450.html
>> > > To unsubscribe from Consuming multiple JMS messages in one single
>> > transaction, visit
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> >
>>
http://camel.465427.n5.nabble.com/Consuming-multiple-JMS-messages-in-one-single-transaction-tp5640489p5746460.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> >
>>
>>
>>
>> --
>> --
>> Scott England-Sullivan
>> Apache Camel Committer
>> Principal Consultant / Sr. Architect | Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Web:     fusesource.com <http://www.fusesource.com> |
>> redhat.com<http://www.redhat.com>
>> Blog:     sully6768.blogspot.com
>> Twitter: sully6768
>>



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io