Exemplo n.º 1
0
    public async Task Handle(ReplyMessage message, IMessageHandlerContext context)
    {
        var incomingAttachment = context.Attachments();

        IntegrationTests.PerformNestedConnection();

        var buffer = await incomingAttachment.GetBytes();

        Debug.WriteLine(buffer);
        using (var stream = await incomingAttachment.GetStream())
        {
            Debug.WriteLine(stream);
        }

        IntegrationTests.HandlerEvent.Set();
    }
    public async Task Handle(SendMessage message, IMessageHandlerContext context)
    {
        var replyOptions = new SendOptions();

        replyOptions.RouteToThisEndpoint();
        var attachment = await context.Attachments().GetBytes("withMetadata");

        Assert.Equal("value", attachment.Metadata["key"]);
        Assert.NotNull(attachment);
        var outgoingAttachment = replyOptions.Attachments();

        outgoingAttachment.AddBytes(attachment);

        IntegrationTests.PerformNestedConnection();

        await context.Send(new ReplyMessage(), replyOptions);
    }