activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lzr <jsw...@163.com>
Subject Re:One session for more consumers
Date Tue, 11 Oct 2011 06:14:30 GMT

Hello all, 

>From time to time I need to make huge transactions(say 40KB per message and 10000 messages
per transaction) to ActiveMQ, after trying all kinds of the configuration mode I found ActiveMQ
couldn't meets this need(Memory limit reached and ActiveMQ Broker doesn't work, and then socket
exception occurred). 

It's much appreciated if any suggestions!




At 2011-10-08 15:45:18,LFS <luks@spoluzaci.cz> wrote:
>Hello,
>I have question whether more Consumers can use one session? or I have create
>for each consumer new session? And one more question. Can I use one instance
>of MyMessageListener for each consumer? or I have create for each consumer
>new instance of MyMessageListener?
>For better idea this is segment of my code:
>
>     ..............
>     session = (ActiveMQSession) connection.createSession(transacted,
>Session.AUTO_ACKNOWLEDGE);
>    // Create the destinations and consumers
>            consumersFromTopic=new
>MessageConsumer[user.getUserfriends().size()];
>            for(int i=0; i<user.getUserfriends().size();i++){
>                User u=user.getUserfriends().get(i);
>                String subject = u.getName()+"sFriendsTopic";
>                Destination d=session.createTopic(subject);
>                MessageConsumer c=session.createConsumer(d);
>                consumersFromTopic[i]=c;
>            }
>
>            //Create messages listeners
>            MyListener = new MyMessageListener(session, user);
>            //Set messages listener to consumers
>            for(MessageConsumer consumer: consumersFromTopic){
>               consumer.setMessageListener(RQMListener);
>            }  
>...............
>Thanks   
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/One-session-for-more-consumers-tp3884602p3884602.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message