Messages ending up in discarded queue

14 views
Skip to first unread message

Andrew

unread,
Nov 17, 2009, 2:14:43 PM11/17/09
to Rhino Tools Dev
Attempting to get the most simple of scenarios going here where I just
do a straightforward pub-sub between 1 publisher and 1 consumer. The
problem I am experiencing is that most of the messages I publish are
ending up in the 'discarded' queue, not in my handler, although a few
of them are processed correctly. I must be missing something obvious,
but can't figure out what! Any suggestions?

My code and config below:


Producer config:
--------------------
<castle>
<facilities>
<facility id="rhino.esb.sender" >
<bus threadCount="1" numberOfRetries="5" endpoint="msmq://localhost/
My.queue" DisableAutoQueueCreation="false" />
<messages>
<add name="My.Messages" endpoint="msmq://localhost/My.queue"/>
</messages>
</facility>
</facilities>
</castle>


Producer code:
--------------------
var container = new WindsorContainer(new XmlInterpreter
("RhinoEsbSettings.xml"));
RhinoServiceBusFacility facility = new RhinoServiceBusFacility();
container.Kernel.AddFacility("rhino.esb.sender", facility);

var bus = container.Resolve<IStartableServiceBus>();
bus.Start();

while (true)
{
ViewInitialized msg = new ViewInitialized {ViewInstanceId =
Guid.NewGuid()};
Console.WriteLine("Sending ViewInitialized message for view '{0}'",
msg.ViewInstanceId);
bus.Send(msg);
Console.ReadLine();
}


Consumer config:
---------------------
<castle>
<facilities>
<facility id="rhino.esb.receiver" >
<bus threadCount="1" numberOfRetries="5" endpoint="msmq://localhost/
My.queue" DisableAutoQueueCreation="false" />
<messages>
<add name="My.Messages" endpoint="msmq://localhost/My.queue" />
</messages>
</facility>
</facilities>
</castle>


Consumer code:
----------------------
var container = new WindsorContainer(new XmlInterpreter
("RhinoEsbSettings.xml"));
container.Register(Component.For<ConsumerOf<ViewInitialized>>
().ImplementedBy<DummyReceiver>().LifeStyle.Transient);

RhinoServiceBusFacility facility = new RhinoServiceBusFacility();
container.Kernel.AddFacility("rhino.esb.receiver", facility);

var bus = container.Resolve<IStartableServiceBus>();

bus.Start();
Console.WriteLine("Ready to receive ViewInitialized messages");
Console.ReadLine();


Receiver class:
-------------------
public class DummyReceiver : ConsumerOf<ViewInitialized>
{
#region Implementation of ConsumerOf<ViewInitialized>
public void Consume(ViewInitialized message)
{
Console.WriteLine("Received ViewInitialized message for view
'{0}'", message.ViewInstanceId);
}
#endregion
}


Thanks

Ayende Rahien

unread,
Nov 17, 2009, 9:49:30 PM11/17/09
to rhino-t...@googlegroups.com
Enable logging, and try to see why it is ending up there.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group.
To post to this group, send email to rhino-t...@googlegroups.com
To unsubscribe from this group, send email to rhino-tools-d...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---


Andrew

unread,
Nov 18, 2009, 6:01:09 AM11/18/09
to Rhino Tools Dev
Ah, think I found the issue. The publisher's bus was pointing to the
same queue where I was publishing messages to. Therefore, both the
publisher and consumer were trying to read messages off same queue
(seems I had inadvertently set up competing consumers). When the
message was picked up by consumer process everything was fine because
I had a ConsumerOf<T> registered in the container. But when it was
picked up by producer, I didn't have any ConsumerOf<T> registered, so
message was dumped to discarded queue.

hth someone else

cheers

On Nov 18, 2:49 am, Ayende Rahien <aye...@ayende.com> wrote:
> Enable logging, and try to see why it is ending up there.
>
> > rhino-tools-d...@googlegroups.com<rhino-tools-dev%2Bunsu...@googlegroups.com>

Andrew

unread,
Nov 18, 2009, 6:04:51 AM11/18/09
to Rhino Tools Dev
I should have include the working producer config just for
completeness:

Producer config:
--------------------
<castle>
<facilities>
<facility id="rhino.esb.sender" >
<bus threadCount="1" numberOfRetries="5"
endpoint="msmq://localhost/
Some.other.queue" DisableAutoQueueCreation="false" />
<messages>
<add name="My.Messages"
endpoint="msmq://localhost/My.queue"/>
</messages>
</facility>
</facilities>
</castle>

I.e. the producer bus is now pointing to the queue "msmq://localhost/
Some.other.queue"
Reply all
Reply to author
Forward
0 new messages