user2562513
user2562513

Reputation: 16

nservicebus subscriber not receiving message

Publisher and subscriber both start up with no bugs, but subscriber does not respond when I publish a message (it's supposed to print something to the screen). Please help!!

Subscriber app.config looks like this:

<add Messages = "Messages" Assembly = "Messages" Endpoint = "MyPublisher" />

Endpoint for Publisher:

Configure.With()
    .DefaultBuilder()
    .JsonSerializer
    .DefiningEventsAs(t => t.Namespace != null && t.Namespace == "Messages")
    .MsmqSubscriptionStorage

Endpoint for subscriber:

Configure.With()
    .DefaultBuilder()
    .JsonSerializer
    .DefiningEventsAs(t => t.Namespace != null && t.Namespace == "Messages");

Upvotes: 0

Views: 2313

Answers (1)

Dennis van der Stelt
Dennis van der Stelt

Reputation: 2178

There's no a lot of information here. But here's what you can test

  1. You specify that the namespace is "Messages" and nothing else. Is this correct? Logging of NServiceBus should state that it found messages and can map these to handlers. So the Assembly name and the namespace should both be "Messages"
  2. You could enable journaling on the Publisher incoming queue. Whenever a subscriber is first started, it starts sending a message to the publisher. No matter what! In that message it says it is subscribing to certain messages. If that message never arrives at the publisher, that's your problem.
  3. Assembly version could be a problem. If the publisher and subscriber have different versions of the assembly with the messages, the publisher will think there are no subscribers.
  4. As for the publisher, the subscriber also needs to be able to map messages to a handler. Logging should state that. Also the subscriber should receive messages. Verify this with turning on journaling.
  5. Test it on a single machine. If on remote machines, the publisher should have a connection in Outgoing Queues folder to the other machine. Same goes for the subscriber after starting the service and sending the subscription message.
  6. Somewhere a subscription message should be stored, unless you're using in memory storage. In other words, when using SQL Server or RavenDB for storage of the subscriptions, the subscription from the subscriber (obviously) should be visible.
  7. If you're using InMemory subscription storage, obviously you should not turn off the publisher, or your subscription will be gone. If you've turned of the publisher, the subscriber needs to send the subscription message again. This is done automatically when the service is started.

Hope this helps find the solution.

Upvotes: 2

Related Questions