예제 #1
0
        HostReceiveEndpointHandle IReceiveConnector <IServiceBusReceiveEndpointConfigurator> .ConnectReceiveEndpoint(IEndpointDefinition definition,
                                                                                                                     IEndpointNameFormatter endpointNameFormatter, Action <IServiceBusReceiveEndpointConfigurator> configureEndpoint)
        {
            if (_host == null)
            {
                throw new InvalidOperationException("The host is not ready.");
            }

            return(_host.ConnectReceiveEndpoint(definition, endpointNameFormatter, configureEndpoint));
        }
 static HostReceiveEndpointHandle ConnectResponseEndpoint(IServiceBusHost host)
 {
     return(host.ConnectReceiveEndpoint(host.Topology.CreateTemporaryResponseQueueName(), x =>
     {
         x.AutoDeleteOnIdle = Defaults.TemporaryAutoDeleteOnIdle;
     }));
 }
예제 #3
0
        /// <summary>
        /// Creates a request client that uses the bus to publish a request.
        /// </summary>
        /// <typeparam name="TRequest">The request type</typeparam>
        /// <typeparam name="TResponse">The response type</typeparam>
        /// <param name="timeout">The timeout before the request is cancelled</param>
        /// <param name="callback">Callback when the request is sent</param>
        /// <param name="ttl">The time that the request will live for</param>
        /// <param name="host"></param>
        /// <param name="publishEndpoint"></param>
        /// <returns></returns>
        public static async Task <IRequestClient <TRequest, TResponse> > CreatePublishRequestClient <TRequest, TResponse>(this IServiceBusHost host,
                                                                                                                          IPublishEndpoint publishEndpoint, TimeSpan timeout, TimeSpan?ttl = default(TimeSpan?), Action <SendContext <TRequest> > callback = null)
            where TRequest : class
            where TResponse : class
        {
            var endpoint = await host.ConnectReceiveEndpoint(host.GetTemporaryQueueName("response")).ConfigureAwait(false);

            var ready = await endpoint.Ready.ConfigureAwait(false);

            return(new PublishRequestClient <TRequest, TResponse>(publishEndpoint, ready.ReceiveEndpoint, ready.InputAddress, timeout, ttl, callback));
        }