transactions - NServiceBus Upgrade SendOnly -


upgrading nservicebus 3.2.8 4.6.1:

i have endpoint.cs looked this:

using system; using nservicebus;  namespace gripmonitor {     public class endpointconfig : iwantcustominitialization, iconfigurethisendpoint, asa_client      {         public void init()         {             setlogginglibrary.log4net(log4net.config.xmlconfigurator.configure);              configure.with(allassemblies.except("oracle.dataaccess.dll"))                 .defaultbuilder()                 .xmlserializer()                 .msmqtransport().transactiontimeout(timespan.fromminutes(5))                 .istransactional(true)                 .unicastbus()                 .donotcreatequeues()                 .sendonly();         }     } } 

and looks this:

using system; using nservicebus;  namespace gripmonitor {     public class endpointconfig : iwantcustominitialization, iconfigurethisendpoint, asa_client     {         public void init()         {             setlogginglibrary.log4net(() => log4net.config.xmlconfigurator.configure());              configure.transactions.enable().advanced( s=> s.defaulttimeout(timespan.fromminutes(5)));             configure.serialization.xml();              configure.with(allassemblies.except("oracle.dataaccess.dll"))                 .defaultbuilder()                 .usetransport<msmq>()                 .unicastbus()                 .donotcreatequeues()                 .sendonly();;          }     } } 

i following unhandled exception , application crashes:

unable set value key: transactions.enabled. settings has been locked modifications. please move configuration code earlier in configuration pipeline.

deleting last line: //.sendonly(); fixes problem.

why this?

thanks, miguel

edit1: changed title

it's little odd have nservicebus.host endpoint send-only, possible. based on name of namespace see in code, take you're monitoring , sending messages monitored thing's status, make sense.

however, .sendonly() extension method meant used shortcut when self-hosting, because finalizes configuration , returns ibus instance.

here's actual (reflected) code .sendonly():

public static ibus sendonly(this configure config) {   configure.endpoint.assendonly();   config.initialize();   return config.builder.build<ibus>(); } 

so problem init() method of endpointconfig implementing iwantcustominitialization runs first in host's startup process (much more information on in blog post nservicebus , mystery of iwantcustominitialization) , @ point, endpoint isn't close being done. default things nservicebus.host endpoint try during startup going attempt modify same settings have been locked , finalized in order return ibus instance.

i think without call .sendonly(), or perhaps insert configure.endpoint.assendonly(); before configure.with()... block.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -