/// <summary> /// Process real time data subscription /// </summary> public IBusMessageOutbound ProcessSubscribe(IBusMessageInbound envelop, PinkoMsgPing pinkoMsgPing) { var response = (IBusMessageOutbound)envelop; pinkoMsgPing.ResponderMachine = PinkoApplication.MachineName; pinkoMsgPing.ResponderDateTime = DateTime.Now; response.Message = pinkoMsgPing; return response; }
public void BrokeredMessageSerialization() { var pinkoContainer = PinkoContainerMock.GetMockContainer(); var pm = new PinkoMsgPing { SenderMachine = "ClientMachine", ResponderMachine = "ServerMachine" }; var bm = AzureQueueClient.FactorNewOutboundMessage(new PinkoServiceMessageEnvelop() {Message = pm}); // check for proepr deserialization var abm = new AzureBrokeredMessageEnvelopInbound(pinkoContainer.Resolve<IPinkoApplication>(), bm); Assert.IsNotNull(abm.Message); Assert.IsTrue(abm.Message.GetType() == typeof(PinkoMsgPing)); Assert.IsTrue(bm.ContentType.Equals(typeof(PinkoMsgPing).ToString())); Assert.IsTrue(abm.PinkoProperties.ContainsKey(PinkoMessagePropTag.MachineName)); Assert.IsTrue(abm.PinkoProperties.ContainsKey(PinkoMessagePropTag.SenderName)); }
public void TestPinkoPingMessageHandler() { var pinkoContainer = PinkoContainerMock.GetMockContainer(); var outboundMessages = pinkoContainer.Resolve<OutbountListener<IBusMessageOutbound>>(); pinkoContainer.RegisterInstance(pinkoContainer.Resolve<InboundMessageReactiveListener<PinkoMsgPing>>().Register()); var pinkoPingMessageHandler = pinkoContainer.Resolve<RoleBusListenerPinkoPingMessageHandle>().Register(); var pm = new PinkoMsgPing { SenderMachine = "UnitTestClientMachine" }; var pme = new PinkoServiceMessageEnvelop() { Message = pm, QueueName = "QueueNameRquest", ReplyTo = "QueueNameResponse" }; pinkoPingMessageHandler.PinkoMsgPingReactiveListener.HandlerAction(pme, pm); Assert.IsTrue(outboundMessages.OutboundMessages.Count == 1); Assert.IsNotNull(outboundMessages.OutboundMessages.First().Message is PinkoMsgPing); }