private static MessageContext publishOutcomeToDataIngressTopic
            (MessageContext outcomeContext)
        {
            if (outcomeContext == null)
            {
                throw new ArgumentNullException(nameof(outcomeContext));
            }


            // post the outcome to the message queue
            var outcomeMessage = new IngressQueueEntry(
                requestId: outcomeContext.Message.RequestId
                // todo:  Change this to use a message identity provider
                , messageId: Guid.NewGuid()
                , message:  outcomeContext.Message.Body
                , messageType: outcomeContext.Message.MessageType
                );

            outcomeContext
            .ServiceContext
            .DataIngressTopic
            .Dispatch(outcomeMessage);

            return(outcomeContext);
        }
        public HttpResponseMessage Post
            (IEnumerable <ExchangeData> exchanges)
        {
            if (exchanges == null)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
            if (exchanges.Count() == 0)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }


            var json
                = ExchangeDataJsonConverter.SerialiseEnumerable(exchanges);

            var queueEntry = new IngressQueueEntry(
                requestId: requestIdentityProvider.GetId()
                // todo: change this to use a message identity provider
                , messageId: Guid.NewGuid()
                , message: json
                , messageType: IngressGatewayTopic.Messages.Exchanges
                );

            Trace.TraceInformation($"[{queueEntry.RequestId}] - Publishing");

            ingressGatewayQueue.Dispatch(queueEntry);

            Trace.TraceInformation($"[{queueEntry.RequestId}] - Published");

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
        public void Dispatch
            (IngressQueueEntry envelope)
        {
            var message = new BrokeredMessage(envelope.Message);

            message.CorrelationId = envelope.RequestId.ToString();
            message.MessageId     = envelope.MessageId.ToString();
            message.ContentType   = envelope.MessageType;

            ingressDataTopic.Send(message);
        }
Esempio n. 4
0
        public void Dispatch
            (IngressQueueEntry queueEntry)
        {
            if (queueEntry == null)
            {
                throw new ArgumentNullException(nameof(queueEntry));
            }


            var message = new BrokeredMessage(queueEntry.Message);

            message.CorrelationId = queueEntry.RequestId.ToString();
            message.MessageId     = queueEntry.MessageId.ToString();
            message.ContentType   = queueEntry.MessageType;

            ingressGatewayTopic.Send(message);
        }