Question

I'm getting the following error when trying to configure an instance of the bus.

No endpoint name could be generated, please specify your own convention using Configure.DefineEndpointName(...)

Hmm so I need to tell the bus about endpoint message mappings. I normally use the app.config to specify this, and it works fine accept for my WPF app, (I'm no expert with WPF).

It appears the app.config is not being read within my WPF app or something is wrong... My startup code looks like this (which works fine in winforms or console app)

        Bus = Configure.With()
            .AutofacBuilder(container)
            .XmlSerializer()
            .MsmqTransport().IsTransactional(true).PurgeOnStartup(false)
            .UnicastBus().ImpersonateSender(false).LoadMessageHandlers()
            .CreateBus()
            .Start(); 

Any suggestions...

Ultimately I would like the message to endpoint mappings stored centrally so that all desktop apps could read this on startup ie. central DB that all clients have access to. An example of how to config the bus this way would be appreciated.

Was it helpful?

Solution

Per the error, just add that to your initialization:

  Bus = Configure.With()
        .AutofacBuilder(container)
        .DefineEndpointName("ENDPOINTNAME")
        .XmlSerializer()
        .MsmqTransport().IsTransactional(true).PurgeOnStartup(false)
        .UnicastBus().ImpersonateSender(false).LoadMessageHandlers()
        .CreateBus()
        .Start();

This will also become your input queue name.

OTHER TIPS

Just to add to the accepted answer above: the order in which you call the methods is important. In my case I couldn't get DefineEndpointName() to work unless it was directly after Configure.With()

      Bus = Configure.With()
            .DefineEndpointName("WPFSubscriber")
            .DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("MyMessages"))
            .Log4Net()
            .DefaultBuilder()
            .XmlSerializer()
            .MsmqTransport()
            .IsTransactional(true)
            .PurgeOnStartup(false)
            .UnicastBus().
            ImpersonateSender(false)
            .LoadMessageHandlers()
            .CreateBus()
            .Start();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top