public override object ServiceMessage(IMessage message) { CommandMessage commandMessage = message as CommandMessage; if (commandMessage != null) { //Sub/unsub handled by base class return(base.ServiceMessage(commandMessage)); } else { AsyncMessage responseMessage = null; DataMessage dataMessage = message as DataMessage; DataDestination dataDestination = this.GetDestination(dataMessage) as DataDestination; if (dataDestination.SubscriptionManager.GetSubscriber(dataMessage.clientId as string) == null) { //Subscribe here as DS doesn't send a separate subscribe command CommandMessage commandMessageSubscribe = new CommandMessage(); commandMessageSubscribe.destination = dataDestination.Id; commandMessageSubscribe.operation = CommandMessage.SubscribeOperation; commandMessageSubscribe.clientId = dataMessage.clientId as string; string endpointId = dataMessage.GetHeader(MessageBase.EndpointHeader) as string; commandMessageSubscribe.headers[MessageBase.EndpointHeader] = endpointId; string flexClientIdHeader = dataMessage.GetHeader(MessageBase.FlexClientIdHeader) as string; if (flexClientIdHeader != null) { commandMessageSubscribe.headers[MessageBase.FlexClientIdHeader] = flexClientIdHeader; } IEndpoint endpoint = GetMessageBroker().GetEndpoint(endpointId); endpoint.ServiceMessage(commandMessageSubscribe);//route through the endpoint again //base.ServiceMessage(commandMessageSubscribe); } switch (dataMessage.operation) { case DataMessage.FillOperation: responseMessage = ExecuteFillOperation(message); break; case DataMessage.GetOperation: responseMessage = ExecuteGetOperation(message); break; case DataMessage.BatchedOperation: case DataMessage.MultiBatchOperation: case DataMessage.TransactedOperation: responseMessage = ExecuteMultiBatchOperation(message); break; case DataMessage.PageItemsOperation: responseMessage = ExecutePageItemsOperation(message); break; case DataMessage.PageOperation: responseMessage = ExecutePageOperation(message); break; case DataMessage.ReleaseCollectionOperation: responseMessage = ExecuteReleaseCollectionOperation(message); break; case DataMessage.GetSequenceIdOperation: responseMessage = ExecuteGetSequenceIdOperation(message); break; case DataMessage.ReleaseItemOperation: responseMessage = ExecuteReleaseItemOperation(message); break; default: if (log.IsErrorEnabled) { log.Error(__Res.GetString(__Res.DataService_Unknown, dataMessage.operation)); } responseMessage = new AcknowledgeMessage(); break; } responseMessage.clientId = message.clientId; responseMessage.correlationId = message.messageId; //Dump(); return(responseMessage); } }
public override object ServiceMessage(IMessage message) { CommandMessage message2 = message as CommandMessage; if (message2 != null) { return(base.ServiceMessage(message2)); } AsyncMessage message3 = null; DataMessage message4 = message as DataMessage; DataDestination destination = base.GetDestination(message4) as DataDestination; if (destination.SubscriptionManager.GetSubscriber(message4.clientId as string) == null) { CommandMessage message5 = new CommandMessage { destination = destination.Id, operation = 0, clientId = message4.clientId as string }; string header = message4.GetHeader("DSEndpoint") as string; message5.headers["DSEndpoint"] = header; string str2 = message4.GetHeader("DSId") as string; if (str2 != null) { message5.headers["DSId"] = str2; } base.GetMessageBroker().GetEndpoint(header).ServiceMessage(message5); } switch (message4.operation) { case 1: message3 = this.ExecuteFillOperation(message); break; case 2: message3 = this.ExecuteGetOperation(message); break; case 5: case 6: case 7: message3 = this.ExecuteMultiBatchOperation(message); break; case 8: message3 = this.ExecutePageOperation(message); break; case 12: message3 = this.ExecuteGetSequenceIdOperation(message); break; case 0x12: message3 = this.ExecuteReleaseCollectionOperation(message); break; case 0x13: message3 = this.ExecuteReleaseItemOperation(message); break; case 20: message3 = this.ExecutePageItemsOperation(message); break; default: if (log.get_IsErrorEnabled()) { log.Error(__Res.GetString("DataService_Unknown", new object[] { message4.operation })); } message3 = new AcknowledgeMessage(); break; } message3.clientId = message.clientId; message3.correlationId = message.messageId; return(message3); }