public async Task <TResponse> SendRequest(TRequest request)
    {
        SendOptions sendOptions = new SendOptions();

        sendOptions.RouteToLocalEndpointInstance();
        return(await busSession.Request <TResponse>(request, sendOptions));
    }
Esempio n. 2
0
        async void Simple()
        {
            IBusSession busSession  = null;
            SendOptions sendOptions = new SendOptions();

            #region EnumCallback
            Message message  = new Message();
            Status  response = await busSession.Request <Status>(message, sendOptions);

            Console.WriteLine("Callback received with response:" + response);
            #endregion
        }
    static async Task SendEnumMessage(IBusSession busSession)
    {
        Console.WriteLine("Message sent");
        #region SendEnumMessage

        EnumMessage message = new EnumMessage();
        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        Status status = await busSession.Request<Status>(message, sendOptions);
        Console.WriteLine("Callback received with status:" + status);
        #endregion
    }
    static async Task SendEnumMessage(IBusSession busSession)
    {
        Console.WriteLine("Message sent");
        #region SendEnumMessage

        EnumMessage message     = new EnumMessage();
        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        Status status = await busSession.Request <Status>(message, sendOptions);

        Console.WriteLine("Callback received with status:" + status);
        #endregion
    }
    static async Task SendIntMessage(IBusSession busSession)
    {
        Console.WriteLine("Message sent");
        #region SendIntMessage

        IntMessage message = new IntMessage();
        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        int response = await busSession.Request<int>(message, sendOptions);
        Console.WriteLine("Callback received with response:" + response);

        #endregion
    }
Esempio n. 6
0
        async void Simple()
        {
            IBusSession busSession  = null;
            SendOptions sendOptions = new SendOptions();

            #region ObjectCallback

            Message         message  = new Message();
            ResponseMessage response = await busSession.Request <ResponseMessage>(message, sendOptions);

            Console.WriteLine("Callback received with response:" + response.Property);

            #endregion
        }
    static async Task SendObjectMessage(IBusSession busSession)
    {
        Console.WriteLine("Message sent");
        #region SendObjectMessage

        ObjectMessage message     = new ObjectMessage();
        SendOptions   sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        ObjectResponseMessage response = await busSession.Request <ObjectResponseMessage>(message, sendOptions);

        Console.WriteLine("Callback received with response property value:" + response.Property);

        #endregion
    }
    static async Task SendIntMessage(IBusSession busSession)
    {
        Console.WriteLine("Message sent");
        #region SendIntMessage

        IntMessage  message     = new IntMessage();
        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        int response = await busSession.Request <int>(message, sendOptions);

        Console.WriteLine("Callback received with response:" + response);

        #endregion
    }
Esempio n. 9
0
        async void Simple()
        {
            IBusSession busSession = null;

            #region CancelCallback

            SendOptions sendOptions       = new SendOptions();
            var         cancellationToken = new CancellationTokenSource();
            sendOptions.RegisterCancellationToken(cancellationToken.Token);
            cancellationToken.CancelAfter(TimeSpan.FromSeconds(5));
            Message message = new Message();
            try
            {
                int response = await busSession.Request <int>(message, sendOptions);
            }
            catch (OperationCanceledException ex)
            {
                // Exception that is raised when the CancellationTokenSource is canceled
            }

            #endregion
        }
Esempio n. 10
0
    static async Task SendObjectMessage(IBusSession busSession)
    {
        Console.WriteLine("Message sent");
        #region SendObjectMessage

        ObjectMessage message = new ObjectMessage();
        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        ObjectResponseMessage response = await busSession.Request<ObjectResponseMessage>(message, sendOptions);
        Console.WriteLine("Callback received with response property value:" + response.Property);

        #endregion
    }