Hi,
I am looking for help in migrating NServiceBus version 3.2.0.0 to 7.0.0.0. Following code is written in 3.2 which needs to be migrated to 7.0.
class clsName: IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
// Note: IConfigureThisEndpoint and AsA_Server are deprecated. and IWantCustomInitialization could not be loaded
{
public void Init()
{
Configure.With() // error: “The name ‘Configure’ does not exists in current context”
.DefaultBuilder()
.JsonSerializer();
SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);
// error: “The name ‘SetLoggingLibrary’ does not exists in current context”
}
}
Any suggestions would be highly appreciated.
I see that configure.With() not supported and JsonSerializer() are not supported from 6.0.
We have still all the upgrade guides available on our documentation website
and so on. For you, it seems you are using the NServiceBus.Host. IConfigureThisEndpoint is a host-specific interface. So, the upgrade guide from the host would apply there:
Are you hosting NServiceBus in Windows Services? Are you also migrating to newer .NET versions? If that is the case, it might be worthwhile to migrate to the new generic host-based hosting model.
Which is mentioned in the deprecation notice of the NServiceBus.Host
Hi Danial, thanks for the quick reply.
Yes, the existing application is using host specific interface and we are hosting in windows service. And the .Net version used is 2013 with framework 2.0.
I tried to migrate to NServiceBus7 with framework 4.6.2. I am stuck at migrating following the code:
Configure.With()
.DefaultBuilder()
JsonSerializer();
If you have any alternate code for this please let me know and I will try to look into link given for upgrading 6 to 7.
DefaultBuilder means NServiceBus is using the internal container. That should just work without you having to specify anything.
When you reach out to us via the above-mentioned non-critical support it might also be possible to share more of your code, should you still struggle, since that will be handled over our case management system and not be visible in the community forum here.
Hi,
Now showing message “name SetLoggingLibrary doesn’t exist in the current context” for the below line of code.
SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure)
Hi,
I am using log4net.Config.XmlConfigurator.Configure(); for this.
And how do I migrate the following to 7.0
Configure.With()
.ForMvc()
where ForMvc() is
public static Configure ForMvc(this Configure configure)
{
// Register our controller activator with NSB
configure.Configurer.RegisterSingleton(typeof(IControllerActivator),
new NServiceBusControllerActivator());
// Find every controller class so that we can register it
var controllers = Configure.TypesToScan
.Where(t => typeof(IController).IsAssignableFrom(t));
// Register each controller class with the NServiceBus container
foreach (Type type in controllers)
configure.Configurer.ConfigureComponent(type, DependencyLifecycle.InstancePerCall);
// Set the MVC dependency resolver to use our resolver
DependencyResolver.SetResolver(new NServiceBusDependencyResolverAdapter(configure.Builder));
return configure;
}
please help me as configure is not available in 7.0