Example #1
0
        /// <summary>
        /// Used by Inbound Connectors, to enQ reference to message in one of many incomingQueues and save as Blob
        /// If Message is in Error, it should be put in SuspendedQueue instead
        /// </summary>
        /// <param name="messages"></param>
        /// <param name="agent"></param>
        /// <returns></returns>
        public bool EnQToIncomingMessageQ(List <IFatpipeMessage> messages, IMessageHandlerAgent agent)
        {
            bool success    = false;
            int  msgCnt     = 0;
            int  msgSuccess = 0;

            foreach (IFatpipeMessage msg in messages)
            {
                msgCnt++;
                success = fpmDal.Enqueue(msg, Constants.QueueType.INBOUND);
                if (success)
                {
                    msgSuccess++;
                }
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// B2B Protocol Engine will take batch of messages from Incoming queue, process each of them
        /// and Write them to OutboundQ with routing info or Suspend them
        /// </summary>
        /// <param name="messages"></param>
        /// <param name="agent"></param>
        /// <returns></returns>
        public bool EnQToOutboundMessageQ(List <IOutboundFatpipeMessage> messages, IMessageHandlerAgent agent)
        {
            bool success    = false;
            int  msgCnt     = 0;
            int  msgSuccess = 0;

            foreach (IOutboundFatpipeMessage msg in messages)
            {
                msgCnt++;

                if (msg.RoutingInfo != null && !string.IsNullOrEmpty(msg.RoutingInfo.PartnerId))
                {
                    msg.Header.Context["PartnerId"]     = msg.RoutingInfo.PartnerId;
                    msg.Header.Context["TransportType"] = msg.RoutingInfo.TransportType.ToString();
                }

                if (msg.RoutingInfo != null)
                {
                    switch (msg.RoutingInfo.TransportType)
                    {
                    case TransportType.Suspend:
                        success = this.fpmDal.SaveSuspendedMessage(msg);
                        break;

                    default:
                        success = this.fpmDal.Enqueue(msg as IFatpipeMessage, Constants.QueueType.OUTBOUND);
                        break;
                    }
                }
                else
                {
                    //TODO: remove after confirming that all outbound messages have routing info
                    success = fpmDal.Enqueue(msg as IFatpipeMessage, Constants.QueueType.OUTBOUND);
                }

                if (success)
                {
                    msgSuccess++;
                }
            }

            return(msgCnt == msgSuccess);
        }
Example #3
0
 /// <summary>
 /// This is a very interesting method. It provides optics into what's going on in the system.
 /// Logic will be specific to agent.
 /// Refer to CorrelationId in message which stitches multiple messages together
 /// Eg. EDI Message M1, received, by AS2
 ///     M1 (correlationId), split into Ms1, Ms2, Ms3, Ms4, by B2BProtocolEngine
 ///     Ms1, sent, by HTTP
 ///     Ms2, sent, by AS2
 ///     Ms2, suspended, by AS2
 /// Common operations are
 /// messageM1, Received, 4/9/2012, By https://maarg.com, WebRole1, WebRoleId1234, ServerCloudMaarg1
 ///
 /// This is a very interesting subject and implementation can be very intelligent.
 /// We will start with a simple one though
 /// </summary>
 /// <param name="message"></param>
 /// <param name="agent"></param>
 /// <returns></returns>
 public bool WriteBusinessTransactionToStore(IFatpipeMessage message, IMessageHandlerAgent agent)
 {
     return(false);
 }