Ejemplo n.º 1
0
        private void InsertToBeForwardedInMessage(string pmodeId, MessageExchangePattern mep, AS4Message tobeForwarded)
        {
            foreach (MessageUnit m in tobeForwarded.MessageUnits)
            {
                string location =
                    Registry.Instance
                    .MessageBodyStore
                    .SaveAS4Message(
                        _as4Msh.GetConfiguration().InMessageStoreLocation,
                        tobeForwarded);

                var inMessage = new InMessage(m.MessageId)
                {
                    Intermediary = true,
                    Operation    =
                        m.MessageId == tobeForwarded.PrimaryMessageUnit.MessageId
                            ? Operation.ToBeForwarded
                            : Operation.NotApplicable,
                    MessageLocation = location,
                    MEP             = mep,
                    ContentType     = tobeForwarded.ContentType
                };

                ReceivingProcessingMode forwardPMode =
                    _as4Msh.GetConfiguration()
                    .GetReceivingPModes()
                    .First(p => p.Id == pmodeId);

                inMessage.SetPModeInformation(forwardPMode);
                inMessage.SetStatus(InStatus.Received);
                inMessage.AssignAS4Properties(m);
                _databaseSpy.InsertInMessage(inMessage);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Prepare <see cref="InMessage"/> as a message that has yet to be determined what it's endpoint will be.
        /// This is used for (quick) saving the incoming message but process the message on a later time.
        /// </summary>
        /// <returns></returns>
        public InMessage BuildAsToBeProcessed()
        {
            if (_messageUnit == null)
            {
                throw new InvalidDataException("Builder needs a Message Unit for building an InMessage");
            }

            var inMessage = new InMessage(_messageUnit.MessageId)
            {
                EbmsRefToMessageId = _messageUnit.RefToMessageId,
                ContentType        = _contentType,
                InsertionTime      = DateTimeOffset.Now,
                ModificationTime   = DateTimeOffset.Now,
                MessageLocation    = _location,
                EbmsMessageType    = DetermineMessageType(_messageUnit),
                MEP       = _mep,
                Operation = Operation.NotApplicable
            };

            inMessage.SetPModeInformation(_pmode);
            inMessage.SetStatus(InStatus.Received);
            inMessage.AssignAS4Properties(_messageUnit);

            return(inMessage);
        }
            private static InMessage CreateInMessage(AS4Message message)
            {
                var result = new InMessage(message.GetPrimaryMessageId())
                {
                    EbmsRefToMessageId = message.PrimaryMessageUnit.RefToMessageId,
                    ContentType        = message.ContentType,
                    Intermediary       = true
                };

                result.EbmsMessageType = MessageType.UserMessage;
                result.Operation       = Operation.ToBeForwarded;

                result.AssignAS4Properties(message.PrimaryMessageUnit);

                return(result);
            }