I've finally gotten around to deploy my solution to our dev environment and I am running into an issue where my endpoint is not receiving published events. this does indeed work on my local machine but not when messages are chatting between remote servers.
edit i'm also running the windows service as the network service and rebus logging is working fine.
Here is my configuration setup:
Publisher
Configure.With(new SimpleInjectorContainerAdapter(container))
.Transport(t => t.UseMsmq("Identity.Web"))
.Subscriptions(s => s.StoreInSqlServer("Integration", "Subscription", true, true))
.Options(b => b.EnableMessageAuditing("Identity.Web.Audit"))
.Options(b => b.SimpleRetryStrategy(errorQueueAddress: "Identity.Web.Error"))
.Start();
Endpoint Receiver
var bus = Configure.With(new CastleWindsorContainerAdapter(container))
.Transport(t => t.UseMsmq("Comply360.User.Management"))
.Subscriptions(s => s.StoreInSqlServer("Integration", "Subscription", isCentralized: true))
.Options(b => b.EnableMessageAuditing("Comply360.User.Management.Audit"))
.Options(b => b.SimpleRetryStrategy(errorQueueAddress: "Comply360.User.Management.Error"))
.Logging(l => l.Serilog(Log.Logger))
.Start();
bus.Subscribe<UserCreated>();
bus.Subscribe<UserUpdated>();
Here is the publishing code:
await this.bus.Publish(new Events.UserUpdated
{
UserId = notification.Id,
Firstname = notification.Firstname,
Lastname = notification.Lastname,
});
And the two records in my subscription store:
Identity.Events.UserCreated, Identity.Messages Comply360.User.Management@MACHINE
Identity.Events.UserUpdated, Identity.Messages Comply360.User.Management@MACHINE
Any help would be greatly appreciated!
I noticed that you're calling bus.Subscribe<TEvent>()
without awaiting the result. You should always either
await bus.Subscribe<TEvent>();
if you're in an async
method, or
bus.Subscribe<TEvent>().Wait();
if you aren't.
However I don't that that is the cause of your problem.
I can see that you correctly await
when you publish - that's good :)
I suspect that it is an issue with MSMQ and queue rights. Could you try and go to Computer Management and take a look at the transactional dead-letter queue on the publisher machine?
If messages were sent, but they did not reach the recipient because of some issue (network issues, user rights issues, + many more), they will end up in the transactional dead-letter queue.