示例#1
0
        public async Task Start()
        {
            try
            {
                var builder = new ContainerBuilder();

                var endpointConfiguration = NSBEndpointConfiguration.ConfigureEndpoint(builder, EndpointName);

                endpointConfiguration.DefineCriticalErrorAction(OnCriticalError);

                endpoint = await Endpoint.Start(endpointConfiguration);

                //schedule send job
                JobManager.AddJob(
                    new SendMessageJob(endpoint),
                    schedule =>
                {
                    schedule
                    .ToRunNow()
                    .AndEvery(3).Seconds();
                });
            }
            catch (Exception ex)
            {
                FailFast("Failed to start.", ex);
            }
        }
示例#2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var endpointConfiguration = NSBEndpointConfiguration.ConfigureEndpoint(EndpointName);

            endpointConfiguration.EnableCallbacks();
            endpointConfiguration.MakeInstanceUniquelyAddressable("InstanceID"); //TODO: needs to be dynamic for scale up...used for callbacks

            services.AddControllers();
            services.AddNServiceBus(endpointConfiguration);
        }
示例#3
0
        public async Task Start()
        {
            try
            {
                var builder = new ContainerBuilder();

                var endpointConfiguration = NSBEndpointConfiguration.ConfigureEndpoint(builder, EndpointName);

                endpointConfiguration.DefineCriticalErrorAction(OnCriticalError);

                endpoint = await Endpoint.Start(endpointConfiguration);
            }
            catch (Exception ex)
            {
                FailFast("Failed to start.", ex);
            }
        }