Help debugging consumers -- message not received

64 views
Skip to first unread message

schaibaa

unread,
May 9, 2012, 11:53:37 AM5/9/12
to masstransit-discuss
Hello everyone,

The board has been extremely helpful before - - especially Dru, so
here I am :)

I've read this thread regarding message construction:
http://groups.google.com/group/masstransit-discuss/browse_thread/thread/7a8538cff725a530/ee3ccd9b9488b7f0?lnk=gst&q=generics#ee3ccd9b9488b7f0

So it looks like what I'm trying to do should work .. essentially I'm
creating a generic type with Activator and publishing that message. I
have a message that contains some type of BaseType - and would like to
register for those types:

var requiredType =
typeof(SomeGenericType<>).MakeGenericType(someMessage.GetType());
var message = Activator.CreateInstance(requiredType, someMessage,
otherStuff);
ServiceBus.Publish(message);

Then my consumer looks like this:

public class MyConsumer :
Consumes<SomeGenericType<SomeMessageType>>.All

public void Consume(SomeGenericType<SomeMessageType> message)
{

}

So far I haven't been able to get the consumer to receive the
message.. Could someone explain the debug process here or provide any
insight? If I look at the RabbitMq management console I do see the
exchange being created.

Thanks!

Dru Sellers

unread,
May 9, 2012, 12:26:34 PM5/9/12
to masstrans...@googlegroups.com
while I know that it is possible, I would question the use of generics in a message contract.

to answer your question I will need to see the complete registration code from both the sender and the receivers 'the servicebusconfigurator' code.

-d



--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group, send email to masstransit-dis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/masstransit-discuss?hl=en.


schaibaa

unread,
May 9, 2012, 12:49:55 PM5/9/12
to masstransit-discuss
Yeah, I am not necessarily in love with it either -- it's just that my
domain is of course hierarchical. I could refactor the messages via
composition, and inheritance - but in this case 'persistence' messages
are dispatched with a particular type to persist and the message
contains some cache data.

Here's the code - the validation bus dispatches the message to the
persistence bus.

var validationBus = ServiceBusFactory.New(sbc =>
{

sbc.UseRabbitMqRouting();

sbc.UseControlBus();

sbc.ReceiveFrom(validationQueueName);


sbc.Subscribe(subs => subs.Consumer(() =>
Kernel.Get<ValidationRequestInterface>()).Permanent());
});

var persistenceBus = ServiceBusFactory.New(sbc =>
{

sbc.UseRabbitMqRouting();

sbc.UseControlBus();

sbc.ReceiveFrom(persistenceQueueName);


sbc.Subscribe(subs => subs.Consumer(() =>
Kernel.Get<PersistenceRequestInterface>()).Permanent());
});

On May 9, 12:26 pm, Dru Sellers <d...@drusellers.com> wrote:
> while I know that it is possible, I would question the use of generics in a
> message contract.
>
> to answer your question I will need to see the complete registration code
> from both the sender and the receivers 'the servicebusconfigurator' code.
>
> -d
>
>
>
>
>
>
>
> On Wed, May 9, 2012 at 10:53 AM, schaibaa <adam.schai...@gmail.com> wrote:
> > Hello everyone,
>
> > The board has been extremely helpful before - - especially Dru, so
> > here I am :)
>
> > I've read this thread regarding message construction:
>
> >http://groups.google.com/group/masstransit-discuss/browse_thread/thre...

schaibaa

unread,
May 9, 2012, 12:54:54 PM5/9/12
to masstransit-discuss
To be more clear, I really shouldn't call it a 'domain' -- it's really
just a set of DTO's. Request types, essentially. That simplifies
validation and observes DRY pretty well.

My message from Validation to Persistence is a 'wrapper' that contains
the request DTO and some cache data (a couple lists of primitives). I
can either do BaseClass request or T Request... or do a class per type
and compose it of the cache and typed request. Just seems like more
bloat that way.

schaibaa

unread,
May 9, 2012, 3:32:56 PM5/9/12
to masstransit-discuss
The use of generics is mostly used for convenience... I have a single
entry point for 'RequestValidator' that validates any request, and if
successful - publishes a message. Without generics, I'd have to get
deeper into reflection to create a non-generic typed message to
publish. That's fine, though. I can work within the framework ..
just wanted to see if there was a good way to debug where the
publishes are going. I am printing the bus introspection and it
declares that it is listening for the correct type of message, FWIW.

Dru Sellers

unread,
May 9, 2012, 6:07:08 PM5/9/12
to masstrans...@googlegroups.com
you can try the outbound logs?

-d
Reply all
Reply to author
Forward
0 new messages