Skip to content

Instantly share code, notes, and snippets.

@AndrewLane
Created November 16, 2016 20:51
Show Gist options
  • Save AndrewLane/13f903d4659b5960d1da00c55d8960fa to your computer and use it in GitHub Desktop.
Save AndrewLane/13f903d4659b5960d1da00c55d8960fa to your computer and use it in GitHub Desktop.
2016-11-16 15:49:39,695 [ 1] INFO Rebus.Routing.TypeBased.TypeBasedRouter - Mapped Shared.Messages.SomeMessage -> somequeue
2016-11-16 15:49:39,715 [ 1] INFO Rebus.Threading.TaskParallelLibrary.TplAsyncTask - Starting periodic task 'CleanupTrackedErrors' with interval 00:01:00
2016-11-16 15:49:39,724 [ 1] INFO Rebus.AmazonSQS.AmazonSqsTransport - Creating a new sqs queue: with name: error on region: US East (Ohio) (us-east-2)
2016-11-16 15:49:40,186 [ 1] INFO Rebus.Threading.TaskParallelLibrary.TplAsyncTask - Starting periodic task 'DueMessagesSender' with interval 00:00:01
2016-11-16 15:49:40,246 [ 1] INFO Rebus.Bus.RebusBus - Starting bus 1
2016-11-16 15:49:40,248 [ 1] INFO Rebus.Bus.RebusBus - Started
2016-11-16 15:49:43,577 [ 1] DEBUG Rebus.Config.RebusConfigurer+<>c - Sending Shared.Messages.SomeMessage -> <no destinations>
2016-11-16 15:49:46,454 [ 1] INFO Rebus.Threading.TaskParallelLibrary.TplAsyncTask - Stopping periodic task 'DueMessagesSender'
2016-11-16 15:49:46,456 [ 1] INFO Rebus.Threading.TaskParallelLibrary.TplAsyncTask - Stopping periodic task 'CleanupTrackedErrors'
using System;
using System.Threading.Tasks;
using Amazon;
using Ninject;
using Rebus.Config;
using Rebus.Log4net;
using Rebus.Ninject;
using Rebus.Routing.TypeBased;
using Shared.Messages;
namespace Publisher
{
class Program
{
static void Main()
{
MainAsync().Wait();
}
static async Task MainAsync()
{
using (var kernel = new StandardKernel())
{
var someContainerAdapter = new NinjectContainerAdapter(kernel);
var bus = Configure.With(someContainerAdapter)
.Logging(l => l.Log4Net())
.Transport(t => t.UseAmazonSqsAsOneWayClient("redacted", "redacted", RegionEndpoint.USEast2))
.Routing(r => r.TypeBased().Map<SomeMessage>(destinationAddress: "somequeue"))
.Start();
while (true)
{
var input = await Console.In.ReadLineAsync().ConfigureAwait(false);
if (input == "q") break;
await bus.Publish(new SomeMessage { When = DateTime.Now, What = input }).ConfigureAwait(false);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment