예제 #1
0
파일: BusStuff.cs 프로젝트: kortov1337/CT
    public static async Task SendToSubscriber(MessageContext context, IReceivingRawEndpoint endpoint)
    {
        var headers = context.Headers;
        var request = new OutgoingMessage(
            messageId: Guid.NewGuid().ToString(),
            headers: headers,
            body: context.Body);

        var operation = new TransportOperation(
            request,
            new UnicastAddressTag(endpoint.EndpointName));

        await endpoint.Dispatch(
            outgoingMessages : new TransportOperations(operation),
            transaction : new TransportTransaction(),
            context : new ContextBag())
        .ConfigureAwait(false);
    }
예제 #2
0
파일: BusStuff.cs 프로젝트: kortov1337/CT
    public static Task Send(string servName, Operation op)
    {
        var body    = Serialize(op);
        var headers = new Dictionary <string, string>
        {
            ["Operation"] = op.OperationType,
            ["To"]        = "Subscriber1"
        };
        var request = new OutgoingMessage(
            messageId: Guid.NewGuid().ToString(),
            headers: headers,
            body: body);

        var operation = new TransportOperation(
            request,
            new UnicastAddressTag(servName));

        serverEndpoint.Dispatch(
            outgoingMessages: new TransportOperations(operation),
            transaction: new TransportTransaction(),
            context: new ContextBag())
        .ConfigureAwait(false);
        return(Task.CompletedTask);
    }