You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vince Iglehart <vi...@kniferiver.com> on 2016/07/05 19:50:26 UTC

Aggregation Completion Criteria

I need some assistance to make sure I'm on the right track.  I think I'm very
close, but I have a couple of missing pieces.  

I have the following SQL statement:
select ticket_date, ticket_nbr, line_nbr, item_desc, quantity
from tickets

I want to group these rows by ticket date, ticket nbr, and line nbr - such
that I will have xml similar to the following in the body of the message:

<sales_order ticket_date="01/01/2016">
	<ticket>
	<ticket_nbr>12345</ticket_nbr>
	<line>
		<line_nbr>1</line_nbr>
		<item_desc>Item desc 1</item_desc>
		<quantity>111</quantity>
	</line>
	<line>
		<line_nbr>2</line_nbr>
		<item_desc>Item desc 2</item_desc>
		<quantity>222</quantity>
	</line>
	<line>
		<line_nbr>3</line_nbr>
		<item_desc>Item desc 3</item_desc>
		<quantity>3</quantity>
	</line>
	<ticket>

	more tickets
</sales_order>

more sales orders




From what I understand, I would accomplish this as follows:

from("direct:start").routeId("Publish Ticket Data")
	.to("sql:classpath:sql/SelectTicketInfo.sql?dataSource=myDataSource")
				
	.split(body())
	.setHeader("ticket_number", simple("${body.get(TICKET_NBR)}"))
	.setHeader("ticket_date", simple("${body.get(TICKET_DATE)}"))

	// build tickets by finding all line nbr's for that ticket
	.aggregate(header("ticket_nbr"), new TicketAgg())

	// build sales order by grouping tickets by ticket date
	.aggregate(header("ticket_date"), new SalesOrderAgg())


	// continue with more stuff


How do I specify a completion criteria such that I know the integration has
aggregated all records into the correct ticket?  After the tickets have been
created, how would I specify a completion criteria so that I know the
integration has aggregated all tickets into a sales order?  

Are there alternatives to accomplish this task?



--
View this message in context: http://camel.465427.n5.nabble.com/Aggregation-Completion-Criteria-tp5784806.html
Sent from the Camel - Users mailing list archive at Nabble.com.