Closed chamikaCN closed 2 years ago
Hi @chamikaCN, Sending multiple AS4 messages in parallel should be no problem, as long as you match the following requirements:
phase4.wss4j.syncsecurity
property is set to true
- see https://github.com/phax/phase4/wiki/Configuration#phase4-propertiesThat's all I am aware of
Thanks @phax
Hi @phax,
One thing I noticed regarding this issue is that MockServletContext
is also not thread-safe and gets created when a message-sending process is initiated in example tests with WebScopeManager.onGlobalBegin (MockServletContext.create ());
. I overcame this problem by ensuring only one context was available when threads handle messages and destroying the context if no thread is in execution. Is there a thread-safe implementation of the ServletContext
interface included in this project or any workaround you'd like to suggest?
I think the MockServletContext
can be made threadsafe quite easily. There is currently no other thread-safe alternative class present - sorry
Will be part of ph-web 9.6.5 release
thanks @phax
Sorry I needed to tackle some other things so it is part of the ph-web 9.7.0 release and will be part of the phase4 1.4.0 release
@chamikaCN Release 1.4.0 from https://github.com/phax/phase4/releases/tag/phase4-parent-pom-1.4.0 should fix the concurrency issue. Please note, that this version switched from Apache HttpClient v4 to v5 which might break existing integrations, so be careful.
Thanks very much for the quick update and the advice as well :slightly_smiling_face: I'll make sure to take precautions prior to upgrading.
Hi Phillip,
I need to run the phase4 project in a multi-threaded environment. I am using the
sendMessageAndCheckForReceipt()
method to send the AS4 message. But as you have noted, it isnon-thread-safe
, since theSignal Message Consumer
being modified inside the method. What would be the your suggestion to achieve my goal?PS- I am using phase4 with my own
SignalMessageConsumer
class, which implementsIAS4SignalMessageConsumer
, hence the null checkaOld == null
on line 706 ofAbstractAS4UserMessageBuilder.java
will always be false.