/// <summary>
        ///     Submit one or more message(s)
        /// </summary>
        /// <param name="submitInfo">The submit information.</param>
        /// <returns></returns>
        /// <exception cref="BusinessException">
        ///     Missing to location
        ///     or
        ///     Missing payload location
        ///     or
        ///     Invalid number of submit messages value. Only a value between 1 &amp; 999 is allowed.
        ///     or
        ///     Could not find pmode
        /// </exception>
        public async Task CreateSubmitMessages(MessagePayload submitInfo)
        {
            try
            {
                if (submitInfo.NumberOfSubmitMessages <= 0 || submitInfo.NumberOfSubmitMessages > 999)
                {
                    throw new BusinessException("Invalid number of submit messages value. Only a value between 1 & 999 is allowed.");
                }

                client.SendInfo($"Looking up PMode {submitInfo.SendingPmode}");
                var sendingPmode = await pmodeService.GetSendingByName(submitInfo.SendingPmode);

                if (sendingPmode == null)
                {
                    throw new BusinessException("Could not find PMode");
                }
                client.SendPmode(AS4XmlSerializer.ToString(sendingPmode.Pmode));

                await CreateSubmitMessageObjects(submitInfo, sendingPmode.Pmode, options.Value.PayloadHttpAddress, options.Value.ToHttpAddress);
            }
            catch (Exception ex)
            {
                client.SendError(ex.Message);
                throw;
            }
        }
Пример #2
0
        /// <summary>
        /// Puts a message with two payloads to the Holodeck endpoint referencing the given <paramref name="pmodeId"/>.
        /// </summary>
        /// <param name="pmodeId">The pmode id the message should have as reference.</param>
        public void PutMessageTwoPayloadsToHolodeckA(string pmodeId)
        {
            var msg = new MessageMetaData
            {
                CollaborationInfo = new HolodeckCollaborationInfo
                {
                    AgreementRef = new HolodeckAgreementRef {
                        PMode = pmodeId
                    },
                    ConversationId = "org:holodeckb2b:test:conversation"
                },
                PayloadInfo = new HolodeckPayloadInfo
                {
                    PartInfo = new[]
                    {
                        SubmitImagePayload,
                        SubmitXmlPayload
                    }
                }
            };

            string xml  = AS4XmlSerializer.ToString(msg);
            string path = Path.Combine(HolodeckALocations.OutputPath, $"{pmodeId}-sample.mmd");

            File.WriteAllText(path, xml);
        }
Пример #3
0
        /// <summary>
        /// Puts a <see cref="SubmitMessage"/> with a given reference to a <see cref="SendingProcessingMode"/>
        /// and with optional payloads references on disk so they get picked-up by the AS4 component.
        /// </summary>
        /// <param name="pmodeId">The identifier to reference a <see cref="SendingProcessingMode"/>.</param>
        /// <param name="payloads">The sequence of submit payloads to include in the message.</param>
        /// <param name="setCustomFixtures">The function to place custom settings to the created message.</param>
        public void PutSubmitMessage(
            string pmodeId,
            Action <SubmitMessage> setCustomFixtures,
            params Payload[] payloads)
        {
            var submitMessage = new SubmitMessage
            {
                Collaboration =
                {
                    AgreementRef   =
                    {
                        PModeId = pmodeId,
                        Value   = "http://agreements.holodeckb2b.org/examples/agreement0"
                    },
                    ConversationId = "eu:edelivery:as4:sampleconversation",
                    Action         = Constants.Namespaces.TestAction,
                    Service        =
                    {
                        Type  = Constants.Namespaces.TestService,
                        Value = Constants.Namespaces.TestService
                    }
                },
                Payloads = payloads
            };

            setCustomFixtures(submitMessage);

            string xml      = AS4XmlSerializer.ToString(submitMessage);
            string fileName = Path.Combine(FullOutputPath, $"submit-{pmodeId}.xml");

            Console.WriteLine($@"Putting {fileName}");
            File.WriteAllText(fileName, xml);
        }
Пример #4
0
        /// <summary>
        /// Gets the receiving p mode string.
        /// </summary>
        /// <returns></returns>
        public string GetReceivingPModeString()
        {
            if (string.IsNullOrWhiteSpace(_receivingPModeString))
            {
                _receivingPModeString = AS4XmlSerializer.ToString(ReceivingPMode);
            }

            return(_receivingPModeString);
        }
        public byte[] SerializeMessage()
        {
            if (_alreadySerializedDeliverMessage.Length == 0)
            {
                _alreadySerializedDeliverMessage = Encoding.UTF8.GetBytes(AS4XmlSerializer.ToString(Message));
            }

            return(_alreadySerializedDeliverMessage);
        }
Пример #6
0
        private void UpdateUserMessagesForDelivery(IEnumerable <UserMessage> userMessages, ReceivingProcessingMode receivingPMode)
        {
            if (userMessages.Any() == false)
            {
                Logger.Trace("No UserMessages present to be delivered");
                return;
            }

            string receivingPModeId     = receivingPMode?.Id;
            string receivingPModeString = AS4XmlSerializer.ToString(receivingPMode);

            var xs = _repository
                     .GetInMessagesData(userMessages.Select(um => um.MessageId), im => im.Id)
                     .Zip(userMessages, Tuple.Create);

            foreach ((long id, UserMessage userMessage) in xs)
            {
                _repository.UpdateInMessage(
                    userMessage.MessageId,
                    message =>
                {
                    message.SetPModeInformation(receivingPModeId, receivingPModeString);

                    if (UserMessageNeedsToBeDelivered(receivingPMode, userMessage) &&
                        message.Intermediary == false)
                    {
                        message.Operation = Operation.ToBeDelivered;

                        RetryReliability reliability =
                            receivingPMode?.MessageHandling?.DeliverInformation?.Reliability;

                        if (reliability?.IsEnabled ?? false)
                        {
                            var r = Entities.RetryReliability.CreateForInMessage(
                                refToInMessageId: id,
                                maxRetryCount: reliability.RetryCount,
                                retryInterval: reliability.RetryInterval.AsTimeSpan(),
                                type: RetryType.Delivery);

                            Logger.Debug(
                                $"Insert RetryReliability for UserMessage InMessage {r.RefToInMessageId} with {{"
                                + $"MaxRetryCount={r.MaxRetryCount}, RetryInterval={r.RetryInterval}}}");

                            _repository.InsertRetryReliability(r);
                        }
                        else
                        {
                            Logger.Trace(
                                "Will not insert RetryReliability for UserMessage(s) so it can be retried during delivery "
                                + $"since the ReceivingPMode {receivingPMode?.Id} MessageHandling.Deliver.Reliability.IsEnabled = false");
                        }

                        Logger.Debug($"Update InMessage UserMessage {userMessage.MessageId} with Operation={message.Operation}");
                    }
                });
            }
        }
        private SendingProcessingMode ExerciseDecorate(SendingProcessingMode pmode, SmpConfiguration smpResponse)
        {
            var doc = new XmlDocument();

            doc.LoadXml(AS4XmlSerializer.ToString(smpResponse));

            var sut = new LocalDynamicDiscoveryProfile(GetDataStoreContext);

            return(sut.DecoratePModeWithSmpMetaData(pmode, doc).CompletedSendingPMode);
        }
        private async Task SubmitMessage(SubmitMessage message, string toLocation)
        {
            client.SendAs4Message(AS4XmlSerializer.ToString(message), message.MessageInfo.MessageId);
            var handler = messageHandlers.First(x => x.CanHandle(toLocation));

            if (handler == null)
            {
                throw new Exception($"No message handler found for {toLocation}");
            }
            await handler.Handle(message, toLocation);
        }
Пример #9
0
        private void OverrideTransformerReceivingPModeSetting(string settingsFileName, string pmodeId)
        {
            string settingsFilePath = Path.Combine(ComponentTestSettingsPath, settingsFileName);
            var    settings         = AS4XmlSerializer.FromString <Settings>(File.ReadAllText(settingsFilePath));

            settings.Agents
            .ReceiveAgents.First()
            .Transformer
            .Setting.First(s => s.Key == "ReceivingPMode")
            .Value = pmodeId;

            File.WriteAllText(settingsFilePath, AS4XmlSerializer.ToString(settings));
        }
            public void ReceivingPModeInformationIsCorrectlySet()
            {
                var entity = new StubMessageEntity();

                var receivingPMode = new ReceivingProcessingMode()
                {
                    Id = "sending_pmode_id"
                };

                entity.SetPModeInformation(receivingPMode);

                Assert.Equal(receivingPMode.Id, entity.PModeId);
                Assert.Equal(entity.PMode, AS4XmlSerializer.ToString(receivingPMode));
            }
Пример #11
0
        private static async Task StoreToBeSentUserMessage(string mpc)
        {
            var submit = new SubmitMessage
            {
                MessageInfo   = new MessageInfo(messageId: null, mpc: mpc),
                Collaboration =
                {
                    AgreementRef =
                    {
                        PModeId  = "pullsendagent-pmode"
                    }
                }
            };

            await SubmitMessageToSubmitAgent(AS4XmlSerializer.ToString(submit));
        }
Пример #12
0
        public void Then_Parties_Are_Filled_When_Defined()
        {
            // Arrange
            var pmode = new PartyInfo {
                FromParty = CreateFilledParty(), ToParty = CreateFilledParty()
            };

            // Act
            string xml = AS4XmlSerializer.ToString(pmode);

            // Assert
            var doc = new XmlDocument();

            doc.LoadXml(xml);

            Assert.NotNull(doc.SelectSingleNode("/PartyInfo/FromParty"));
            Assert.NotNull(doc.SelectSingleNode("/PartyInfo/ToParty"));
        }
Пример #13
0
        /// <summary>
        /// Gets the name of the receiving by.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public Task <ReceivingBasePmode> GetReceivingByName(string name)
        {
            return(Task
                   .Factory
                   .StartNew(() =>
            {
                var pmode = SafeGetReceivingPMode(name);
                if (pmode != null)
                {
                    return new ReceivingBasePmode
                    {
                        Name = pmode.Id,
                        Type = PmodeType.Receiving,
                        Pmode = pmode,
                        Hash = AS4XmlSerializer.ToString(pmode).GetMd5Hash()
                    };
                }

                return null;
            }));
        }
        public void DecorateMandatoryInfoToSendingPMode()
        {
            // Arrange
            var smpResponse = new SmpConfiguration
            {
                PartyRole = "role",
                Url       = "http://some/url"
            };

            var doc = new XmlDocument();

            doc.LoadXml(AS4XmlSerializer.ToString(smpResponse));

            var pmode = new SendingProcessingMode();
            var sut   = new LocalDynamicDiscoveryProfile(GetDataStoreContext);

            // Act
            SendingProcessingMode actual = sut.DecoratePModeWithSmpMetaData(pmode, doc).CompletedSendingPMode;

            // Assert
            Assert.Equal(smpResponse.Url, actual.PushConfiguration.Protocol.Url);
        }
Пример #15
0
        /// <summary>
        /// Set the PMode that is used to process the message.
        /// </summary>
        /// <param name="pmode"></param>
        public void SetPModeInformation(IPMode pmode)
        {
            if (pmode != null)
            {
                PModeId = pmode.Id;

                // The Xml Serializer is not able to serialize an interface, therefore
                // the argument must first be cast to a correct implementation.

                if (pmode is SendingProcessingMode sp)
                {
                    PMode = AS4XmlSerializer.ToString(sp);
                }
                else if (pmode is ReceivingProcessingMode rp)
                {
                    PMode = AS4XmlSerializer.ToString(rp);
                }
                else
                {
                    throw new NotImplementedException("Unable to serialize the the specified IPMode");
                }
            }
        }
Пример #16
0
 /// <summary>
 /// Assigns the parent properties.
 /// </summary>
 /// <param name="messageUnit">The MessageUnit from which the properties must be retrieved..</param>
 public void AssignAS4Properties(MessageUnit messageUnit)
 {
     if (messageUnit is UserMessage userMessage)
     {
         FromParty      = userMessage.Sender.PartyIds.First().Id;
         ToParty        = userMessage.Receiver.PartyIds.First().Id;
         Action         = userMessage.CollaborationInfo.Action;
         Service        = userMessage.CollaborationInfo.Service.Value;
         ConversationId = userMessage.CollaborationInfo.ConversationId;
         Mpc            = userMessage.Mpc;
         IsTest         = userMessage.IsTest;
         IsDuplicate    = userMessage.IsDuplicate;
         SoapEnvelope   = AS4XmlSerializer.ToString(UserMessageMap.Convert(userMessage));
     }
     else
     {
         if (messageUnit is SignalMessage signalMessage)
         {
             IsDuplicate = signalMessage.IsDuplicate;
             Mpc         = signalMessage.MultiHopRouting.Select(r => r.mpc).GetOrElse(Constants.Namespaces.EbmsDefaultMpc);
         }
     }
 }
        /// <summary>
        /// Retrieves the SMP meta data <see cref="XmlDocument" /> for a given <paramref name="party" /> using a given
        /// <paramref name="properties" />.
        /// </summary>
        /// <param name="party">The party identifier to select the right SMP meta-data.</param>
        /// <param name="properties">The information properties specified in the <see cref="SendingProcessingMode"/> for this profile.</param>
        public Task <XmlDocument> RetrieveSmpMetaDataAsync(Model.Core.Party party, IDictionary <string, string> properties)
        {
            if (party == null)
            {
                throw new ArgumentNullException(nameof(party));
            }

            if (party.PrimaryPartyId == null ||
                party.PartyIds.FirstOrDefault()?.Type == null ||
                party.Role == null)
            {
                throw new InvalidOperationException(
                          "Given invalid 'ToParty', requires 'Role', 'PartyId', and 'PartyType'");
            }

            SmpConfiguration configuration = FindSmpResponseForToParty(party);
            string           xml           = AS4XmlSerializer.ToString(configuration);

            var document = new XmlDocument();

            document.LoadXml(xml);

            return(Task.FromResult(document));
        }
Пример #18
0
        private static void TestConfigInitialization(
            Action <Settings> alterSettings,
            Action <Config> onInitialized)
        {
            string testSettingsFileName = Path.Combine(
                Config.ApplicationPath, "config", "test-settings.xml");

            string originalSettingsFileName = Path.Combine(
                Config.ApplicationPath, "config", "settings.xml");

            var settings = AS4XmlSerializer
                           .FromString <Settings>(File.ReadAllText(originalSettingsFileName));

            alterSettings(settings);

            File.WriteAllText(
                testSettingsFileName,
                AS4XmlSerializer.ToString(settings));

            File.Copy(
                originalSettingsFileName,
                testSettingsFileName,
                overwrite: true);

            Directory.CreateDirectory(Path.Combine(Config.ApplicationPath, "config", "send-pmodes"));
            Directory.CreateDirectory(Path.Combine(Config.ApplicationPath, "config", "receive-pmodes"));

            // Act
            Config.Instance.Initialize(testSettingsFileName);

            // Assert
            onInitialized(Config.Instance);

            // TearDown
            File.Delete(testSettingsFileName);
        }
        /// <summary>
        /// Asserts the SOAP envelope.
        /// </summary>
        /// <param name="expected">The expected.</param>
        /// <param name="actual">The actual.</param>
        public static void AssertSoapEnvelope(UserMessage expected, MessageEntity actual)
        {
            string xmlRepresentation = AS4XmlSerializer.ToString(UserMessageMap.Convert(expected));

            Assert.Equal(xmlRepresentation, actual.SoapEnvelope);
        }
Пример #20
0
        protected virtual void SetupDataStore()
        {
            using (datastoreContext = new DatastoreContext(options, StubConfig.Default))
            {
                string pmodeString = AS4XmlSerializer.ToString(pmode);
                string pmodeId     = pmode.Id;

                {
                    var message = new InMessage(ebmsMessageId: InEbmsMessageId1)
                    {
                        EbmsRefToMessageId = InEbmsRefToMessageId1,
                        InsertionTime      = DateTime.UtcNow.AddMinutes(-1),
                    };
                    message.SetStatus(InStatus.Created);
                    message.SetPModeInformation(pmodeId, pmodeString);
                    datastoreContext.InMessages.Add(message);
                }

                {
                    var message = new InMessage(ebmsMessageId: InEbmsMessageId2)
                    {
                        EbmsRefToMessageId = InEbmsRefToMessageId2,
                        InsertionTime      = DateTime.UtcNow.AddMinutes(-1)
                    };
                    message.SetStatus(InStatus.Received);
                    datastoreContext.InMessages.Add(message);
                }

                {
                    var message = new OutMessage(OutEbmsMessageId1)
                    {
                        EbmsRefToMessageId = OutEbmsRefToMessageId1,
                        InsertionTime      = DateTime.UtcNow.AddMinutes(-1)
                    };
                    message.SetStatus(OutStatus.Created);

                    datastoreContext.OutMessages.Add(message);
                }

                {
                    var message = new OutMessage(OutEbmsMessageId2)
                    {
                        EbmsRefToMessageId = OutEbmsRefToMessageId2,

                        InsertionTime = DateTime.UtcNow.AddMinutes(-1)
                    };
                    message.SetStatus(OutStatus.Created);
                    datastoreContext.OutMessages.Add(message);
                }

                InException inEx1 = Entities.InException.ForEbmsMessageId(InEbmsMessageId1, InException);
                inEx1.InsertionTime = DateTime.UtcNow.AddMinutes(-1);
                datastoreContext.InExceptions.Add(inEx1);

                InException inEx2 = Entities.InException.ForEbmsMessageId(InEbmsMessageId1, InException);
                inEx2.InsertionTime = DateTime.UtcNow.AddMinutes(-1);
                datastoreContext.InExceptions.Add(inEx2);

                InException inEx3 = Entities.InException.ForMessageBody(MessageLocation, InException);
                inEx3.InsertionTime = DateTime.UtcNow.AddMinutes(-1);
                datastoreContext.InExceptions.Add(inEx3);

                OutException outEx1 = Entities.OutException.ForEbmsMessageId(OutEbmsRefToMessageId1, InException);
                outEx1.InsertionTime = DateTime.UtcNow.AddMinutes(-1);
                datastoreContext.OutExceptions.Add(outEx1);

                OutException outEx2 = OutException.ForEbmsMessageId(InEbmsRefToMessageId1, Exception);
                outEx2.InsertionTime = DateTime.UtcNow.AddMinutes(-1);
                datastoreContext.OutExceptions.Add(outEx2);

                OutException outEx3 = OutException.ForMessageBody(MessageLocation, Exception);
                outEx3.InsertionTime = DateTime.UtcNow.AddMinutes(-1);
                datastoreContext.OutExceptions.Add(outEx3);

                datastoreContext.SaveChanges();

                foreach (var inMessage in datastoreContext.InMessages)
                {
                    inMessage.SetPModeInformation(pmodeId, pmodeString);
                }

                foreach (var outMessage in datastoreContext.OutMessages)
                {
                    outMessage.SetPModeInformation(pmodeId, pmodeString);
                }

                foreach (var inException in datastoreContext.InExceptions)
                {
                    inException.SetPModeInformation(pmodeId, pmodeString);
                }

                foreach (var outException in datastoreContext.OutExceptions)
                {
                    outException.SetPModeInformation(pmodeId, pmodeString);
                }

                datastoreContext.SaveChanges();
            }
        }
Пример #21
0
                protected override void SetupDataStore()
                {
                    using (datastoreContext = new DatastoreContext(options, StubConfig.Default))
                    {
                        datastoreContext.InMessages.Add(new InMessage(ebmsMessageId: InEbmsMessageId1)
                        {
                            EbmsRefToMessageId = InEbmsRefToMessageId1,
                        });
                        datastoreContext.InMessages.Add(new InMessage(ebmsMessageId: InEbmsRefToMessageId1));

                        datastoreContext.OutMessages.Add(new OutMessage(ebmsMessageId: InEbmsRefToMessageId1));

                        datastoreContext.InMessages.Add(new InMessage(ebmsMessageId: "RANDOM")
                        {
                            EbmsRefToMessageId = InEbmsMessageId1,
                        });
                        datastoreContext.InMessages.Add(new InMessage(ebmsMessageId: InEbmsMessageId2));

                        datastoreContext.OutMessages.Add(new OutMessage(ebmsMessageId: OutEbmsMessageId1)
                        {
                            EbmsRefToMessageId = OutEbmsRefToMessageId1
                        });
                        datastoreContext.OutMessages.Add(new OutMessage(ebmsMessageId: OutEbmsMessageId2)
                        {
                            EbmsRefToMessageId = OutEbmsMessageId1
                        });
                        datastoreContext.InMessages.Add(new InMessage(ebmsMessageId: Guid.NewGuid().ToString())
                        {
                            EbmsRefToMessageId = OutEbmsMessageId1
                        });
                        datastoreContext.InMessages.Add(new InMessage(ebmsMessageId: OutEbmsRefToMessageId1)
                        {
                            EbmsRefToMessageId = Guid.NewGuid().ToString()
                        });

                        datastoreContext.OutMessages.Add(new OutMessage(ebmsMessageId: _outEbmsMessage3));

                        datastoreContext.OutMessages.Add(new OutMessage(ebmsMessageId: Guid.NewGuid().ToString())
                        {
                            EbmsRefToMessageId = _outEbmsMessage3
                        });
                        datastoreContext.InMessages.Add(new InMessage(ebmsMessageId: Guid.NewGuid().ToString())
                        {
                            EbmsRefToMessageId = _outEbmsMessage3
                        });

                        datastoreContext.InMessages.Add(new InMessage(ebmsMessageId: Guid.NewGuid().ToString()));

                        datastoreContext.OutMessages.Add(new OutMessage(Guid.NewGuid().ToString()));

                        // Forwareded message
                        var newinMessage = new InMessage(ForwardedMessageId);
                        newinMessage.Operation = Operation.Forwarded;
                        datastoreContext.InMessages.Add(newinMessage);
                        var newOutMessage = new OutMessage(ForwardedMessageId);
                        newOutMessage.Operation = Operation.ToBeSent;
                        datastoreContext.OutMessages.Add(newOutMessage);

                        var pmodeId     = pmode.Id;
                        var pmodeString = AS4XmlSerializer.ToString(pmode);

                        foreach (var inMessage in datastoreContext.InMessages)
                        {
                            inMessage.SetPModeInformation(pmodeId, pmodeString);
                        }
                        foreach (var outMessage in datastoreContext.OutMessages)
                        {
                            outMessage.SetPModeInformation(pmodeId, pmodeString);
                        }

                        datastoreContext.SaveChanges();
                    }
                }
Пример #22
0
        /// <summary>
        /// Updates an <see cref="AS4Message"/> for delivery and notification.
        /// </summary>
        /// <param name="as4Message">The message.</param>
        /// <param name="receivingPMode"></param>
        /// <param name="messageBodyStore">The as4 message body persister.</param>
        /// <param name="sendingPMode"></param>
        /// <exception cref="ArgumentNullException"></exception>
        /// <returns></returns>
        public void UpdateAS4MessageForMessageHandling(
            AS4Message as4Message,
            SendingProcessingMode sendingPMode,
            ReceivingProcessingMode receivingPMode,
            IAS4MessageBodyStore messageBodyStore)
        {
            if (as4Message == null)
            {
                throw new ArgumentNullException(nameof(as4Message));
            }

            if (messageBodyStore == null)
            {
                throw new ArgumentNullException(nameof(messageBodyStore));
            }

            if (as4Message.HasUserMessage)
            {
                string savedLocation =
                    messageBodyStore.SaveAS4Message(_configuration.InMessageStoreLocation, as4Message);

                IEnumerable <string> userMessageIds = as4Message.UserMessages.Select(u => u.MessageId);

                _repository.UpdateInMessages(
                    m => userMessageIds.Any(id => id == m.EbmsMessageId),
                    m => m.MessageLocation = savedLocation);
            }

            if (receivingPMode?.MessageHandling?.MessageHandlingType == MessageHandlingChoiceType.Forward)
            {
                Logger.Debug($"Received AS4Message must be forwarded since the ReceivingPMode {receivingPMode?.Id} MessageHandling has a <Forward/> element");

                string pmodeString = AS4XmlSerializer.ToString(receivingPMode);
                string pmodeId     = receivingPMode.Id;

                // Only set the Operation of the InMessage that represents the
                // Primary Message-Unit to 'ToBeForwarded' since we want to prevent
                // that the same message is forwarded more than once (x number of messaging units
                // present in the AS4 Message).

                _repository.UpdateInMessages(
                    m => as4Message.MessageIds.Contains(m.EbmsMessageId),
                    m =>
                {
                    m.Intermediary = true;
                    m.SetPModeInformation(pmodeId, pmodeString);
                    Logger.Debug($"Update InMessage {m.EbmsMessageType} with {{Intermediary={m.Intermediary}, PMode={pmodeId}}}");
                });

                _repository.UpdateInMessage(
                    as4Message.GetPrimaryMessageId(),
                    m =>
                {
                    m.Operation = Operation.ToBeForwarded;
                    Logger.Debug($"Update InMessage {m.EbmsMessageType} with Operation={m.Operation}");
                });
            }
            else if (receivingPMode?.MessageHandling?.MessageHandlingType == MessageHandlingChoiceType.Deliver)
            {
                UpdateUserMessagesForDelivery(as4Message.UserMessages, receivingPMode);
                UpdateSignalMessagesForNotification(as4Message.SignalMessages, sendingPMode);
            }
            else
            {
                UpdateSignalMessagesForNotification(as4Message.SignalMessages, sendingPMode);
            }
        }