1
votes

I have a szenario which seems at the first glance like a perfect fit for using a Spring Integration Aggregator:

A Large amount of PDF Report's are produced currently. These are printed via Printrequests to a JMS Queue. A Print Server accepts client sockets with print requests.

In order to achieve a certain about of "fairness" in terms of load, we would like to aggregate the print requests for the same printer. And then send the aggregated requests to the Print Server. We have completness criterias for the aggregated requests, basically the number of pdf produced for a "Batch" and also have a unique key per "Batch" of requested PDF reports. The aggregated requests would then be "sent" via a service activator to the Print Server via the same client Socket. So basically we are taking the approach described in Spring Integration Documentation.

The problem : the reports will only start printing, when the last pdf report of the "Batch" is produced, which seems to create quite a bottle neck.

Ideally we could start to print as soon as the first Message of a MessageGroup arrives and effectively aggregate the results of a print request.

I have been thinking to achieve this with a custom MessageStore, where the

public void add(Message<?> messageToAdd)

Method implements the additional logic call the Printer Server and actually aggregating the responses of the Server. Something like a "active" MessageStore.

But then the add Method of custom MessageStore could be a "big" Bottleneck... blocking each add to a "active" MessageStore... and also seems like the wrong metapher: Store vs Processing something.

Is the Aggregator the right approach for these requirements?

Or should i should go more for the approach a dynamic router channel decribed in the Dynamic Ftp Spring Integration Example

With a child(s) / parent applicationscontext for each "Batch" of print requests? There the lifecycle of the childs applicationcontext is not quite so clear to me.

Ideally i would be able to manage all context's - childs and parents with JMX as described in the Monitoring Example of Spring Integration

1

1 Answers

0
votes

Looks like you have some Buttered cat paradox.

You want to minimize Network load via aggregated request, but at the same time you want to send each item from aggregator to print.

You should decide for yourself what is really your goal.

Maybe you just need a router which logic will be based on some key to delegate to the proper channel for particular socket to send to the Print Server?

Otherwise sorry: your problem isn't clear...