Ejemplo n.º 1
0
 static InterceptMessageForwarding Fold(InterceptMessageForwarding left, InterceptMessageForwarding right)
 {
     return((queue, message, dispatch, forward) =>
     {
         return left(queue, message, dispatch, d =>
         {
             return right(queue, message, d, forward);
         });
     });
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Configures the switch to invoke a provided callback when processing messages.
 /// </summary>
 /// <param name="interceptMethod">Callback to be invoked.</param>
 public void InterceptForwarding(InterceptMessageForwarding interceptMethod)
 {
     InterceptMethod = interceptMethod ?? throw new ArgumentNullException(nameof(interceptMethod));
 }
Ejemplo n.º 3
0
        internal IPort Create(RuntimeTypeGenerator typeGenerator, string poisonQueue, bool?hubAutoCreateQueues, string hubAutoCreateQueuesIdentity, InterceptMessageForwarding interceptMethod, int immediateRetries, int delayedRetries, int circuitBreakerThreshold)
        {
            var routing = new RoutingConfiguration(typeGenerator, EndpointInstances, subscriptionStorage, DistributionPolicy);

            return(new Port <T>(Name, customization, routing, poisonQueue, maximumConcurrency, interceptMethod,
                                autoCreateQueues ?? hubAutoCreateQueues ?? false, autoCreateQueuesIdentity ?? hubAutoCreateQueuesIdentity, immediateRetries, delayedRetries, circuitBreakerThreshold, nullForwarding));
        }
Ejemplo n.º 4
0
    public Port(string name, Action <TransportExtensions <T> > transportCustomization, RoutingConfiguration routingConfiguration, string poisonQueue, int?maximumConcurrency, InterceptMessageForwarding interceptMethod, bool autoCreateQueues, string autoCreateQueuesIdentity, int immediateRetries, int delayedRetries, int circuitBreakerThreshold, InterBridgeRoutingSettings forwarding)
    {
        this.routingConfiguration = routingConfiguration;
        this.interceptMethod      = interceptMethod;
        this.forwarding           = forwarding;
        Name        = name;
        sendRouter  = routingConfiguration.PrepareSending();
        replyRouter = new ReplyRouter();

        rawConfig = new ThrottlingRawEndpointConfig <T>(name, poisonQueue, ext =>
        {
            SetTransportSpecificFlags(ext.GetSettings(), poisonQueue, name);
            transportCustomization?.Invoke(ext);
        },
                                                        async(context, _) =>
        {
            var intent = GetMesssageIntent(context);
            if (intent == MessageIntentEnum.Subscribe || intent == MessageIntentEnum.Unsubscribe)
            {
                await subscriptionReceiver.Receive(context, intent);
            }
            await onMessage(context);
        },
                                                        (context, dispatcher) => context.MoveToErrorQueue(poisonQueue),
                                                        maximumConcurrency,
                                                        immediateRetries, delayedRetries, circuitBreakerThreshold, autoCreateQueues, autoCreateQueuesIdentity);
    }