public EndpointHandle(ReceiveEndpoint endpoint, ReceiveTransportHandle transportHandle, StartEndpointReadyObserver observer)
            {
                _endpoint = endpoint;
                _observer = observer;

                TransportHandle = transportHandle;
            }
Beispiel #2
0
            public async Task Should_be_asynchronous()
            {
                var shutdown = new CancellationTokenSource();

                var inputAddress = new Uri("loopback://localhost/input_queue");

                var transport = new InMemoryTransport(inputAddress, Environment.ProcessorCount);

                TaskCompletionSource <int> received = GetTask <int>();

                IPipe <ReceiveContext> receivePipe = Pipe.New <ReceiveContext>(x =>
                {
                    x.UseFilter(new DelegateFilter <ReceiveContext>(context =>
                    {
                        Console.WriteLine("Message: {0}", context.TransportHeaders.Get("MessageId", "N/A"));

                        received.TrySetResult(1);
                    }));
                });

                ReceiveTransportHandle receiveHandle = ((IReceiveTransport)transport).Start(receivePipe);

                var sendEndpoint = new SendEndpoint(transport, new JsonMessageSerializer(), inputAddress,
                                                    inputAddress);

                await sendEndpoint.Send(new A(), TestCancellationToken);

                await received.Task;

                shutdown.Cancel();

                await receiveHandle.Stop();
            }
Beispiel #3
0
 public Handle(ReceiveEndpoint endpoint, ReceiveTransportHandle transportHandle, ReceiveEndpointContext context)
 {
     _endpoint        = endpoint;
     _transportHandle = transportHandle;
     _context         = context;
 }
 public void Start()
 {
     TransportHandle = _transport.Start();
 }
Beispiel #5
0
 public Handle(ReceiveTransportHandle transportHandle)
 {
     _transportHandle = transportHandle;
 }
Beispiel #6
0
        ReceiveEndpointHandle IReceiveEndpoint.Start()
        {
            ReceiveTransportHandle transportHandle = _receiveTransport.Start(_receivePipe);

            return(new Handle(transportHandle));
        }
 public Handle(ReceiveTransportHandle transportHandle)
 {
     _transportHandle = transportHandle;
 }