Example #1
0
        // Obtain the session on which the AMQP receiver link should be created and then delegate
        // to the ISubscriberLinker implementation associated with the host item (Queue/Topic).
        // The subscriber-linker will bind the message handler to the host item so it will be
        // invoked when a message is received.
        private void LinkSubscriber(HostItemSubscriber subscriber, ISubscriptionSettings subscriptionSettings)
        {
            Session           session = ConnectionModule.CreateReceiverSession(subscriber.HostAttribute.HostName);
            ISubscriberLinker linker  = subscriber.HostItemAttribute.Linker;

            linker.SetServices(DispatchModule, _serialization, Context.LoggerFactory);

            // Delegate to the subscriber linker implementation to handle received messages:
            linker.LinkSubscriber(session, subscriber, subscriptionSettings);
        }
Example #2
0
        private async Task LinkHandlersToHostItems(ISubscriptionSettings subscriptionSettings)
        {
            if (subscriptionSettings == null)
            {
                throw new ArgumentNullException(nameof(subscriptionSettings));
            }

            // Initialize any host provided AMQP settings - i.e. creating host specific
            // subscriptions to AMQP defined topics.
            await _subscriptionSettings.ConfigureSettings();

            ConnectionModule.SetReceiverConnectionCloseHandler(ReSetReceiverLinkOnClosedConn);

            foreach (var subscriber in _subscribers)
            {
                LinkSubscriber(subscriber, subscriptionSettings);
            }
        }