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); }
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); }