[rabbitmq-discuss] Subscribe queueName in RabbitMQ
Кристина Лаптева
laptevakristi at gmail.com
Mon Mar 3 11:14:48 GMT 2014
private int handledMessages;
clusteringMessageBroker.Subscribe(
clusteringOutputQueueName, ProcessMessage,
typeof(ClusteringOutputMessage));
Thread.Sleep(380000);
clusteringMessageBroker.Unsubscribe(clusteringOutputQueueName,
ProcessMessage);
private void ProcessMessage(object message)
{
clusteringMessage = (ClusteringOutputMessage)message;
log.InfoFormat("add message {0}",
clusteringMessage.UpdatedClusters.Count());
handledMessages++;
log.InfoFormat("Consumed {0} messages ", handledMessages);
log.InfoFormat("ConsumedMessage {0}", handledMessages);
var cluster = clusteringMessage.UpdatedClusters;
var updatedClusters = cluster.Select(
c =>
new ClusteringOutputMessage.Cluster
{
Id = c.Id,
MainArticleId = c.MainArticleId,
ArticlesIds = c.ArticlesIds
}).ToList();
foreach (var updatedCluster in updatedClusters)
{
log.InfoFormat("id {0}", updatedCluster.Id);
log.InfoFormat("mainid {0}", updatedCluster.MainArticleId);
foreach (var articleId in updatedCluster.ArticlesIds)
{
log.InfoFormat("ArticleId {0}", articleId);
}
}
}
I want to sibscribing clusteringOutputQueueName, but listening to the queue
happens once in stages, according to several reports, and it turns out that
the cycle runs several times and can not count the number of clusters.
I want to count updatedCluster.Id and i want to compare
updatedCluster.ArticlesIds with the known value.
Help me please!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140303/20dc904c/attachment.html>
More information about the rabbitmq-discuss
mailing list