FAQ
Hi All,

Can some body point me a good example of using camel to consume Topic
message from ActiveMQ?
Primarily i need to implement the connection/thread/session pooling while
consuming message.

Thanks

--
View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5012908.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Search Discussions

  • Bvahdat at Nov 22, 2011 at 8:34 am
    Hi,

    [1] could be a good starting point, also make sure that you subscribe to the
    mailing-list, look at [2] for details.

    [1]
    https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-spring-jms/
    [2] http://camel.apache.org/discussion-forums.html

    Babak

    --
    View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5012929.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Cbenaveen at Nov 22, 2011 at 8:48 am
    bvahdat,
    Thanks for the pointer.

    More than consuming i need example on how to reuse the connections,
    sessions.

    are there any example which show me how to do connection pooling for a Topic
    Consumer.

    By the way i did subscribed to the mailing list.

    --
    View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5012957.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Bvahdat at Nov 22, 2011 at 9:07 am
    You could also check the section 'Working with Spring's JmsTemplate' in [1]:

    The PooledConnectionFactory supports the pooling of Connection, Session and
    MessageProducer instances so it can be used with tools like Camel and
    Spring's JmsTemplate and MessagListenerContainer . Connections, sessions and
    producers are returned to a pool after use so that they can be reused later
    without having to undergo the cost of creating them again.

    [1] http://activemq.apache.org/spring-support.html

    Babak


    --
    View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5012993.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Cbenaveen at Nov 23, 2011 at 10:01 am
    Babak,
    From the [1] PooledConnectionFactory API doc, i understand that the polling
    can be achieved for the producer, not for the consumer.

    My requirement is more off pooling consumer connection/sesssion rather than
    producer.

    [1]
    http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/pool/PooledConnectionFactory.html



    --
    View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5016143.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Bvahdat at Nov 23, 2011 at 10:55 am
    Hi

    not sure if I really understand you right, nevertheless I give it a try:

    looking at the POC code you provided in [1] your (jms) consumer is inside
    the class you called RouteProducer. For that consumer you could for sure
    setup connection pooling as well as thread-pooling capabilities, see the
    "connectionFactory" & "concurrentConsumers" options in [2]. Behind the scene
    camel uses Spring DefaultMessageListenerContainer.

    Question: Did you try what I proposed in [3], if yes what happend then?

    [1]
    http://camel.465427.n5.nabble.com/Camle-ActiveMQ-connection-polling-and-threading-issue-tp5012594p5012594.html
    [2] http://camel.apache.org/jms
    [3]
    http://camel.465427.n5.nabble.com/Camle-ActiveMQ-connection-polling-and-threading-issue-tp5012594p5013176.html

    Babak

    --
    View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5016229.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Cbenaveen at Nov 24, 2011 at 8:07 am
    Babak,
    Below is the brief which may help you to understand my use case.

    I have application which uses ActiveMQ (V 5.3.0) as MOM. We are using Camel
    (V 2.7.2) to CONSUME messages from the MOM server.

    One of the Module belongs to my application needs to register to camel with
    7 unique subject for each incoming request. For e.g this module will
    register 3500 unique subject to MOM server through camel for 500 incoming
    request. As the subject are unique i cant make use of wildcard here.

    In a real scenario, this module may need to serve up to 30000 such incoming
    request. Hence the max registration may goes up to 210000.

    Along whith the above module, I do have other module which also registers to
    the MOM through the Camel API. But the number of subject registration is
    less.

    Hope now you got a clear understanding of my use case.

    I have slightly modified my code (to make use of Spring
    CachingConnectionFactory and JmsComponent) now and i am able to add upto
    4000 in a single camel context.

    But this is not sufficenat at all as the CachingConnectionFactory caches
    single connection. Hence i am expecting to have pool of connection so that i
    can handle this huge load.

    Reg the memory setting, i gone upto -Xmx2048m (on my 64 bit RHEL 5.x) by
    which i can add upto 4000 routes to the camle context. I could not go beyond
    this limit.

    --
    View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5019526.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Bvahdat at Nov 24, 2011 at 2:31 pm
    Hi,

    happy to see that you've done some progress on this "high-load-requirement"
    issue, and that now we both use the same vocabulary, that's CONSUMER and not
    PRODUCER (just think of the camel's RouteBuilder class of yours you called
    it RouteProducer in [1]).
    But this is not sufficenat at all as the CachingConnectionFactory caches
    single connection. Hence i am expecting to have pool of connection so
    that i can handle this huge load.
    Just to mention 2 possible choices:
    - org.apache.activemq.pool.PooledConnectionFactory
    - org.jencks.amqpool.PooledConnectionFactory
    which don't only cache jms sessions but also the connections as well. Just
    customize them in your spring-wiring-setup or Java code so that they would
    fit into you requirements.

    At last please note that like you I'm also just a Apache Camel user and I do
    also should dig into Camel source, samples, test cases, google, etc. to
    solve the problems I'm facing while developing (right now just think about
    that trivial CachingConnectionFactory question of yours).

    Just my last 2 cents:
    Try to find out what Apache Camel can do for you and what not (as far as you
    can on your own), and if still stuck, then use the forum. IMHO there's
    almost nothing impossible while using Apache Camel as it provides such a
    wonderful open-to-extension-and-customization API that one can (almost)
    never get stuck in unsolvable problems.

    [1]
    http://camel.465427.n5.nabble.com/Camle-ActiveMQ-connection-polling-and-threading-issue-tp5012594p5012594.html

    Wish you best luck by your requirements
    Babak

    --
    View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5020313.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Bvahdat at Nov 24, 2011 at 8:22 pm
    Hi again,

    BTW the online javadoc link you've provided in your previous post [1] is not
    that much up-to-date, try [2] for a better javadoc documentation
    (activemq-pool-5.5.0) which is more accurate regarding the JMS connection &
    session pooling.

    [1]
    http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/pool/PooledConnectionFactory.html
    [2]
    http://activemq.apache.org/maven/5.5.0/activemq-pool/apidocs/org/apache/activemq/pool/PooledConnectionFactory.html

    Good luck
    Babak


    --
    View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5021256.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Claus Ibsen at Nov 22, 2011 at 8:57 am
    Hi

    See Torstens blog
    http://tmielke.blogspot.com/2011/11/consuming-topic-messages-in-spring-and.html

    He has other great posts on AMQ / Camel etc.

    On Tue, Nov 22, 2011 at 9:27 AM, cbenaveen wrote:
    Hi All,

    Can some body point me a good example of using camel to consume Topic
    message from ActiveMQ?
    Primarily i need to implement the connection/thread/session pooling while
    consuming message.

    Thanks

    --
    View this message in context: http://camel.465427.n5.nabble.com/Topic-consume-with-polling-connection-thread-Need-exmple-tp5012908p5012908.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    Twitter: davsclaus, fusenews
    Blog: http://davsclaus.blogspot.com/
    Author of Camel in Action: http://www.manning.com/ibsen/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedNov 22, '11 at 8:34a
activeNov 24, '11 at 8:22p
posts10
users3
websitecamel.apache.org

3 users in discussion

Bvahdat: 5 posts Cbenaveen: 4 posts Claus Ibsen: 1 post

People

Translate

site design / logo © 2022 Grokbase