I have this use case.
First chain:
<int:chain input-channel="inserimentoCanaleActivate" output-channel="inserimentoCanalePreRouting"> <int:service-activator ref="inserimentoCanaleActivator" method="activate" /> </int:chain>
This is the relative code:
@Override @Transactional(propagation = Propagation.REQUIRES_NEW) public EventMessage<ModificaOperativitaRapporto> activate(EventMessage<InserimentoCanale> eventMessage) { ...
Everything works great.
Then I have another chain:
<int:chain id="onlineCensimentoClienteChain" input-channel="ONLINE_CENSIMENTO_CLIENTE" output-channel="inserimentoCanaleActivate"> <int:service-activator ref="onlineCensimentoClienteActivator" method="activate" /> <int:splitter expression="payload.getPayload().getCanali()" /> </int:chain>
And relative activator:
@Override public EventMessage<CensimentoCliente> activate(EventMessage<CensimentoCliente> eventMessage) { ...
The CensimentoCliente payload, as described below, has a List payload of the first chain, so the splitter I breaks into a list and reuses the code of the first chain.
public interface CensimentoCliente extends Serializable { Collection<? extends InserimentoCanale> getCanali(); void setCanali(Collection<? extends InserimentoCanale> canali); ... }
But since each activator gets its own definition of a transaction (since the first one can live without the second), I have a case where transactions are split.
The goal is to modify the db of two circuits as part of the same transaction.
Any help?
Regards Massimo
source share