Petals-SE-POJO 2.6.0+

compared with
Current by Christophe DENEUX
on Feb 29, 2024 16:31.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (4)

View Page History
* a {{public boolean onExchange(Exchange exchange, AbstractJBIListener jbiLIstener)}} MUST be provided.
* a {{public boolean onAsyncExchange(Exchange subExchange, AsyncContext asyncContext, AbstractJBIListener jbiListener)}} CAN be provided, optionally.
* a {{public boolean onExpiredAsyncJBIMessage(Exchange void onExpiredAsyncExchange(Exchange subExchange, AsyncContext asyncContext, AbstractJBIListener jbiListener)}} CAN be provided, optionally.
* all methods can throw exceptions.
* FaultException is used to represent business faults (as declared in the WSDL contract): the XML content of the Fault is passed to the constructor of the exception,
}

public void onExpiredAsyncJBIMessage(Exchange onExpiredAsyncExchange(Exchange subExchange, AsyncContext asyncContext, AbstractJBIListener jbiListener)
throws MessagingException {
[...Handle here the subExchange timeout...]
Any asynchronous response from the 'sub-exchange' comes back in the {{onAsyncExchange(Exchange subExchange, AsyncContext asyncContext, AbstractJBIListener jbiListener)}} method. During the process of this method, the 'sub-exchange' must be handled according to the MEP, and the returns {{true}} of the method let the CDK send the 'sub-exchange' to the partner.
Once all 'sub-exchanges' are received, the 'original' exchange can be retrieve from the asynchronous context and the response or acknowledgement send back explicitly.
If a 'sub-service' do not response at time, the {{onExpiredAsyncJBIMessage(...)}} {{onExpiredAsyncExchange(...)}} method will be invoked by the CDK. automatically. You must handle the timeout of the 'sub-exchange' in this method.
Note that once a {{sendAsync(...)}} has expired, the POJO does not have the ownership of the exchange anymore (because it was sent but never came back) and can't access anything else than the exchangeId and the exchange status! The {{AsyncContext}}, which can be subclassed when needed, is there to store needed information in these situations.

jbiListener.getComponent().getPlaceHolders().getProperty("your-property-name")
{code}
where {{jbiListener}} is the JBI listener transmitted through methods {{onExchange(...)}}, {{onAsyncExchange(...)}} or {{onExpiredAsyncJBIMessage(...)}} {{onExpiredAsyncExchange(...)}} of your POJO class.

h2. Service Configuration