Hi

If you mean that the tables are "cleaned up" then yes that is by
design. The tables are storing in-progress aggregations, when they are
completed and processed finished then their rows are deleted.

On Tue, Apr 5, 2022 at 10:13 AM Reto Peter <reto.pe...@advanceit.ch> wrote:
>
> Hi
>
> Using the JdbcAggregationRepository I am trying to save the relation between 
> my incoming messages and the aggregate, as a 1-n relation. It is actually the 
> EDI Messages (Single message) into the EDI Interchange (Collection of 
> messages).
> When I run the route, I see that the entries are available in the my-SQL 
> aggregation table.
> If the aggregate is finished, then all the entries are gone, both tables 
> aggregation and aggregation_completed are empty
> Is that normal? Or Do I have an error somewhere in my setup?
>
> I was trying to find another solution to get my relation saved. In my 
> AggregatorStrategy class, in the aggregate method I did save a list of 
> messages, and in the onCompletion method, I set that list as a Header. This 
> works only if I use the correlationExpression 'true', but actually I do 
> aggregate messages with same doctype like "DESADV" and "INVOIC" and then the 
> value of the Header is always just the one from the last processed aggregate
>
> My route looks like this (simplified)
>
> from("file:{{dir.from}}")
> .choice()
> .when()....setHeader("doctype").constant("DESADV")
> .when()....setHeader("doctype").constant("INVOICE")
> .aggregate(header("doctype"), new 
> EDIMessageToInterchangeAggregator()).aggregationRepository("repo3")
> .log("Header: ${header.messageIDList}") // Shows always the latest Aggregate 
> Header only
>
> If I run message for one doctype only, then it all works, cause there will 
> only be one aggregate
>
> My bean config is like this:
>        <bean id="repo3"
>          
> class="org.apache.camel.processor.aggregate.jdbc.JdbcAggregationRepository">
>          <property name="repositoryName" value="test_aggregation"/>
>          <property name="transactionManager" ref="txManager"/>
>          <property name="dataSource" ref="datasource"/>
>          <!-- configure to store the message body and following headers as 
> text in the repo -->
>
>          <property name="storeBodyAsText" value="true"/>
>          <property name="headersToStoreAsText">
>            <list>
>              <value>doctype</value>
>              <value>messageID</value>
>              <value>interchangeID</value>
>            </list>
>          </property>
>        </bean>
>
>        <bean id="txManager" 
> class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
>        <property name="dataSource" ref="datasource"/>
>        </bean>
>
> My environment:
> Camel 3.16.0
> Java 11
> SpringBoot 2.6.4
> MySQL 8.x
>
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to