Esempio n. 1
0
 public Channel(CompositeMessageLogger logger, SubscriberAddress address, Uri replyUri, ISendingAgent agent)
 {
     LocalReplyUri = replyUri;
     _logger       = logger;
     _address      = address;
     _agent        = agent;
 }
Esempio n. 2
0
        public HandlerPipeline(BusMessageSerializationGraph serializers, HandlerGraph graph, IReplyWatcher replies, CompositeMessageLogger logger, IEnumerable <IMissingHandler> missingHandlers, Lazy <IServiceBus> bus)
        {
            _serializer      = serializers;
            _graph           = graph;
            _replies         = replies;
            _bus             = bus;
            _missingHandlers = missingHandlers.ToArray();

            Logger = logger;
        }
Esempio n. 3
0
 public MessageRouter(BusMessageSerializationGraph serializers, IChannelGraph channels, ISubscriptionsRepository subscriptions, HandlerGraph handlers, CompositeMessageLogger logger, UriAliasLookup lookup, BusSettings settings)
 {
     _serializers   = serializers;
     _channels      = channels;
     _subscriptions = subscriptions;
     _handlers      = handlers;
     _logger        = logger;
     _lookup        = lookup;
     _settings      = settings;
 }
Esempio n. 4
0
 public ServiceBus(IMessageRouter router, IReplyWatcher watcher, IHandlerPipeline pipeline, BusMessageSerializationGraph serialization, BusSettings settings, IChannelGraph channels, IPersistence persistence, CompositeMessageLogger logger)
 {
     _router        = router;
     _watcher       = watcher;
     _pipeline      = pipeline;
     _serialization = serialization;
     _settings      = settings;
     _channels      = channels;
     Persistence    = persistence;
     _logger        = logger;
 }
Esempio n. 5
0
 public ServiceBusActivator(BusSettings settings, IHandlerPipeline pipeline, IScheduledJobProcessor scheduledJobs, BusMessageSerializationGraph serialization, IEnumerable <ITransport> transports, UriAliasLookup lookups, IWorkerQueue workerQueue, CompositeMessageLogger logger, IPersistence persistence)
 {
     _settings          = settings;
     _pipeline          = pipeline;
     this.scheduledJobs = scheduledJobs;
     _serialization     = serialization;
     _transports        = transports.ToArray();
     _lookups           = lookups;
     _workerQueue       = workerQueue;
     _logger            = logger;
     _persistence       = persistence;
 }
Esempio n. 6
0
        public WorkerQueue(CompositeMessageLogger logger, IHandlerPipeline pipeline, BusSettings settings, CancellationToken cancellationToken)
        {
            _logger            = logger;
            _pipeline          = pipeline;
            _settings          = settings;
            _cancellationToken = cancellationToken;

            foreach (var worker in _settings.Workers.AllWorkers)
            {
                AddQueue(worker.Name, worker.Parallelization);
            }

            ScheduledJobs = InMemoryScheduledJobProcessor.ForQueue(this);
        }
Esempio n. 7
0
        public MessagingRoot(
            ObjectPoolProvider pooling,
            BusSettings settings,
            HandlerGraph handlers,
            Forwarders forwarders,
            IPersistence persistence,
            IChannelGraph channels,
            ISubscriptionsRepository subscriptions,
            IEnumerable <ISerializerFactory> serializers,
            IEnumerable <IMessageDeserializer> readers,
            IEnumerable <IMessageSerializer> writers,
            IMessageLogger[] loggers,
            ITransport[] transports,
            IEnumerable <IMissingHandler> missingHandlers,
            IEnumerable <IUriLookup> lookups)
        {
            _settings    = settings;
            _handlers    = handlers;
            _replies     = new ReplyWatcher();
            _persistence = persistence;
            _channels    = channels;
            _transports  = transports;



            Lookup = new UriAliasLookup(lookups);


            Serialization = new BusMessageSerializationGraph(pooling, settings, handlers, forwarders, serializers,
                                                             readers, writers);

            Logger = new CompositeMessageLogger(loggers);

            Pipeline = new HandlerPipeline(Serialization, handlers, _replies, Logger, missingHandlers,
                                           new Lazy <IServiceBus>(Build));

            Workers = new WorkerQueue(Logger, Pipeline, settings);

            Router = new MessageRouter(Serialization, channels, subscriptions, handlers, Logger, Lookup, settings);

            ScheduledJobs = new InMemoryScheduledJobProcessor();
        }
Esempio n. 8
0
        public void Start(BusSettings settings, ITransport[] transports, UriAliasLookup lookups,
                          CapabilityGraph capabilities, CompositeMessageLogger logger, IWorkerQueue workers)
        {
            _lookups  = lookups;
            _settings = settings;
            _logger   = logger;

            organizeTransports(settings, transports);


            if (settings.DefaultChannelAddress != null)
            {
                DefaultChannel = GetOrBuildChannel(settings.DefaultChannelAddress);
            }

            assertNoUnknownTransportsInSubscribers(settings);


            assertNoUnknownTransportsInListeners(settings);

            foreach (var transport in _transports.Values)
            {
                transport.StartListening(settings, workers);
            }

            buildInitialSendingAgents(settings);



            GetOrBuildChannel(TransportConstants.RetryUri);

            SystemReplyUri =
                capabilities.DefaultReceiverLocation
                ?? tryGetReplyUri("http")
                ?? tryGetReplyUri("tcp")
                ?? _transports.Values.FirstOrDefault(x => x.LocalReplyUri != null)?.LocalReplyUri;
        }
Esempio n. 9
0
 public Channel(CompositeMessageLogger logger, ISendingAgent agent, Uri replyUri)
     : this(logger, new SubscriberAddress(agent.Destination), replyUri, agent)
 {
 }
Esempio n. 10
0
        public async Task <int> put__messages_durable(HttpRequest request, ILocalWorkerSender workers, CompositeMessageLogger logger)
        {
            try
            {
                // TODO -- optimize the reading here to reduce allocations
                var bytes = await request.Body.ReadBytesAsync(request.ContentLength);

                var envelopes = Envelope.ReadMany(bytes);

                await workers.EnqueueDurably(envelopes);

                return(200);
            }
            catch (Exception e)
            {
                var message = $"Error receiving envelopes from {request.Headers["x-jasper-envelope-sender"]}";
                logger.LogException(e, message: message);

                return(500);
            }
        }