How to properly dump i/o messages and as4 receipts? #204
-
Hello Philip Sorry if this is already answered or if it should be obvious by the examples, but I need some verification I got it right
Regarding (1) I am implementing an IAS4ServletMessageProcessorSPI processor similar to your below example that saves dumps to disk If I understand correctly, the processAS4ResponseMessage() dumps the outgoing AS4 responses FROM this AP (replies to other APs initiated requests). The processAS4UserMessage() and processAS4SignalMessage() dumps incoming AS4 messages and I will keep them all like your examples. Regarding (2), I implemented a AbstractAS4RawResponseConsumer<> to use with msgbuilder.rawResponseConsumer(). I assume that on a succesful transmission, the AS4 response that reaches handleResponse() can be used as a message receipt. Do you see anything wrong in the above reasonings? By the way regarding sending files, I see that in the as4 response I get, I see:
Initially I thought that RefToMessageId would be the InstanceIdentifier, but it seems that MessageId is another UUID generated later by phase4. Do I have access to this during sending? Is there any processor similar to IAS4ServletMessageProcessorSPI in order to dump exported messages and final generated soap? Many thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Well, for that reason I introduced the This particular example And yes, your assumption that "AS4 Message ID" and "SBDH Instance ID" are two different things is correct. This is because a) the SBDH could be created by C1 already and b) in case of retries on an AS4 level a new AS4 message ID created foir each transmission. To access the AS4 message ID you can a) create a new UUID and pass it into the builder via |
Beta Was this translation helpful? Give feedback.
-
Thanks for the guidance. One more question: IAS4IncomingDumper and IAS4OutgoingDumper are very convenient when you are about to write to a file, but it gets tricky when you want to dump to a database. I.e. the flow in this case is to create a stream in memory in onNewRequest() but you will actually use it inside onEndRequest(), as it will be at this point that you have the completed stream to dump. (same as onBeginRequest() and onEndRequest()) The dumper implementation in this case has to somehow create streams in onNewRequest() and understand which one is completed in onEndRequest() in order to dump it to the database properly and discard it. However there are 2 problems with this: a) The stream is closed by the caller of onNewRequest(), so I am not sure if it's safe to use it inside onEndRequest() (in C# closed memory streams are actually disposed) and b) It's not obvious how to map created and completed streams. Maybe ideally I could have another callback that would give me the completed stream and some info about the message, before it's closed, i.e. onStreamClosing() or something like that. Maybe I am missing something? |
Beta Was this translation helpful? Give feedback.
Well, for that reason I introduced the
IAS4IncomingDumper
andIAS4OutgoingDumper
that give you the possibility to dump all messages on the wire, even the ones that are invalid AS4 messages. The SPI processors however are only invoked for incoming "valid AS4 messages". Global dumpers are set viaAS4DumpManager.setIncomingDumper
andAS4DumpManager.setOutgoingDumper
. For sending you can also use the global once or use the builder methods.incomingDumper
and.outgoingDumper
to set specific instances per transmission.This particular example
ExampleReceiveMessageProcessorSPI
you mention has two original intentions: a) show that multiple SPI handlers are possible and b) show how to "de-onioniz…