Skip to content

Newtonsoft Json Serializer

Damian Maclennan edited this page Jan 20, 2015 · 1 revision

First thing we're going to need to install the package for the JSON Serializer

Install-Package Nimbus.Serializers.Json

Now we can go ahead and configure Nimbus as usual:

var connectionString = ConfigurationManager.AppSettings["AzureConnectionString"];
var typeProvider = new AssemblyScanningTypeProvider(Assembly.GetExecutingAssembly());
var messageHandlerFactory = new DefaultMessageHandlerFactory(typeProvider);

var bus = new BusBuilder()
    .Configure()
    .WithNames("MyApplication", Environment.MachineName)
    .WithConnectionString(connectionString)
    .WithTypesFrom(typeProvider)
    .WithDefaultHandlerFactory(messageHandlerFactory)
    .WithDefaultTimeout(TimeSpan.FromSeconds(10))
    .WithJsonSerializer()
    .Build();
bus.Start();

return bus;

Notice the ".WithJsonSerializer()". This is all you need for setup.