You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by manua <ag...@gmail.com> on 2011/07/08 16:15:23 UTC

Publisher stops publishing when a subscriber is attached to that topic

Hi All,

I am having a activemq publisher which publishes 1000s of messages per
second. Its working fine, until I place an subscriber on that topic.

When the subscriber is put on the topic, it works fine for first 70000-80000
messages but after that the publisher stops publishing on the topic. If i
remove the subscriber, the publisher starts publishing message on the topic
and works fine.

Please find below the code snippet from my subscriber,

string brokerURI = "failover:(tcp://" + sBrokerNPort +
")?wireFormat=openwire&keepAlive=true&wireFormat.maxInactivityDuration=0";

oReq = new clAMQ(brokerURI, sDataRequestQ, 1);
oReq->connect();
oReq->createConsumer();

void onMessage(void *msg) {

	string symbol = clAMQ::getStringPropertyFromMessage(msg,"S");
	string timestamp = clAMQ::getStringPropertyFromMessage(msg,"T");
	double price = clAMQ::getDoubleFromMapMessage(msg,"P");
	long size = clAMQ::getLongFromMapMessage(msg,"VS");

        cout << "msg : " << symbol << price << endl;

       clAMQ::acknowledgeMsg(msg);
}

What could be the reason for this.

Thanks,
Manu




--
View this message in context: http://activemq.2283324.n4.nabble.com/Publisher-stops-publishing-when-a-subscriber-is-attached-to-that-topic-tp3654216p3654216.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Publisher stops publishing when a subscriber is attached to that topic

Posted by Torsten Mielke <to...@fusesource.com>.
Is your subscriber slow by any chance and not keeping up with the rate
at which msgs get produced?
The topic subscription inside the broker then fills up with msgs until
you hit a configured memory limit. 
Once the limit is hit, producer flow control kicks in and stops the
producer until enough msgs got consumed
to continue.

I bet producer flow control is kicking in. After some time producer
should resume.
Also, try a slower producer rate to verify this.

Hope this helps. 
 
Torsten Mielke
FuseSource
tmielke.blogspot.com