Reputation: 17
I am using Camel to read messages off an Amazon SQS queue, do some CPU-intensive processing, and then place them on another SQS queue. Camel is being invoked through the maven plugin, using mvn camel:run
.
When run on a server with multiple cores, Camel only appears to be using a single core to process messages (as observed by monitoring CPU utilization of all cores). How can I take advantage of all available cores?
Things I have tried:
mvm camel:run
jobs in parallel). This works, but does not seem ideal.maxMessagesPerPoll=10
on the consumer. Did not appear to make a difference.The route in question:
<route id="marctomods" errorHandlerRef="eh">
<from uri="aws-sqs://{{sqs.environment}}-normalize-marcxml?accessKey=${access.key}&secretKey=${secret.key}&amazonSQSClient=#sqsClient&maxMessagesPerPoll=10" />
<process ref="modsProcessor"/>
<to uri="aws-sqs://{{sqs.environment}}-enrich?accessKey=${access.key}&secretKey=${secret.key}&amazonSQSClient=#sqsClient" />
</route>
Upvotes: 1
Views: 1183
Reputation: 2678
You generally only get a single message in transit through a route. http://camel.apache.org/parallel-processing-and-ordering.html explains the parallel processing options.
You could, for example, read messages from sqs onto a seda queue and then have multiple parallel consumers reading from the seda queue, eg
<route>
<from uri="aws-sqs://{{sqs.environment}}-normalize-marcxml />
<to uri="seda:myQueue">
</route>
<route>
<from uri="seda:myQueue?concurrentConsumers=10" />
<process ref="modsProcessor"/>
<to uri="aws-sqs://{{sqs.environment}}-enrich>
</route>
Upvotes: 0