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 7898613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:28:50+00:00 2026-06-03T08:28:50+00:00

I´m playing with MassTransit with a simple example and I don´t know what I´m

  • 0

I´m playing with MassTransit with a simple example and I don´t know what I´m doing wrong, because I don´t receive the correct data.
I have a simple asp.net-mvc app with the following code in the HomeController

public class TweetCreatedCommand : Command
{
    public readonly string Message;
    public readonly DateTime Timestamp;
    public readonly Guid TweetId;
    public readonly string Who;

    public TweetCreatedCommand(Guid tweetId, string message, DateTime timeStamp, string who)
    {
        TweetId = tweetId;
        Message = message;
        Timestamp = timeStamp;
        Who = who;
    }
}

public ActionResult Index()
    {
        TweetCreatedCommand data;

        Bus.Initialize(sbc =>
        {
            sbc.UseMsmq();
            sbc.VerifyMsmqConfiguration();
            sbc.UseMulticastSubscriptionClient();
            sbc.ReceiveFrom("msmq://localhost/test_queue");
            sbc.Subscribe(subs =>
            {
                subs.Handler<TweetCreatedCommand>(msg => data = new TweetCreatedCommand(msg.TweetId, msg.Message,msg.Timestamp,msg.Who));
            });
        });

        Bus.Instance.Publish(new TweetCreatedCommand(Guid.NewGuid(),"foo!",DateTime.Now,"CDA"));

                    ViewData.Model = data;

        return View();
    }

If I debug this code, I can see how the TweetCreatedCommand is published and the data is OK in the MSMQ queue, but when the handler receives the data:
TweetCreatedCommand.TweetId is: 00000000-0000-0000-0000-000000000000 and it should be other thing
TweetCreatedCommand.Message is null and it should be “foo!”
TweetCreatedCommand.TimeStamp is 01/01/01
Who is null and it should be “CDA”

What is wrong??

Any help would be appreciated

  • 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-06-03T08:28:51+00:00Added an answer on June 3, 2026 at 8:28 am

    MassTransit’s default serialization only works on properties. Try changing your readonly fields to properties and the serializer should populate the data correctly. If readonly fields are required, change to the BinarySerializer (default is JSON).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Playing around with customizing the appearance of the Wizard control in ASP.Net, and I've
Playing with a Mobile application in ASP.NET MVC4 beta, using great that article ,
Im playing about with some very simple windows forms. I have an event handler
Playing with jquery for the first time, and I'm trying to get a simple
Playing around with MongoDB and NoRM in .NET. Thing that confused me - there
After playing around with haskell a bit I stumbled over this function: Prelude Data.Maclaurin>
Im playing a little bit with heavy-client app. Imagine I have this model: class
When playing a sound using e.g: sound(x,fs); I sometimes by accident play the wrong
Still playing with Chrome Extension and have a little problem when I want to
Playing around with Google Maps these days, with some directions. I have a map

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.