Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4047274
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:40:13+00:00 2026-05-20T13:40:13+00:00

I am trying to get a simple NServiceBus pub/sub working. Here is what I

  • 0

I am trying to get a simple NServiceBus pub/sub working. Here is what I am trying to do.
I am trying to read a message from msmq, and pub publishes the messages to sub, and the sub will insert the messages to sub’s queue. (right now, there are all on same computer).

I have a pub and a sub (there are Written as console apps). I also have a Message class, and here it is.

    [Serializable]
public class Message : IEvent
{
    public string name { get; set; }

}

public interface IEvent : IMessage
{
    string name { get; set; }

}

And, this is my pub

            IBus bus = NServiceBus.Configure.With()
            .DefaultBuilder()
            .XmlSerializer()
            .MsmqTransport()
                .IsTransactional(true)
               .PurgeOnStartup(false)
            .UnicastBus()
            .ImpersonateSender(false)
            .MsmqSubscriptionStorage()
            .CreateBus().
            Start(); 

sub looks same execpt that it has .LoadMessageHandlers().

I understand that you have to handle the message, where do you put the Handle() on sub side? I want to read them and put them into sub’s queue.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:40:13+00:00Added an answer on May 20, 2026 at 1:40 pm

    The Publisher will handle putting messages in the Subscriber’s queue. To handle those messages, you must implement the IHandleMessages<T> interface on a class in your subscriber. NSB will execute the Handle method on that class when a message of that type shows up. For example:

    public class MyMessageHandler : IHandleMessages<Message>;
    {
        // do stuff here 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a simple winsock program working, so I create my socket
So i am trying to get a simple system working where i have an
I'm trying to get simple code working, unfortunately I'm a python beginner. My script
Trying to get a simple test perl script working. Have the following files/folder structure
I am trying to get a simple effect working in jQuery, and only have
I'm trying to use NServiceBus to send messages from a console process (very similar
Trying to get a simple COUNT from a table that takes a couple of
I'm trying to get a simple python script from the learnpythonthehardway tutorial to show
I have been trying to get simple YES/NO radio buttons list working but facing
I'm trying to get this simple PowerShell script working, but I think something is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.