Call Processor from Custom Aggregation Strategy - apache-camel

I want to call a new processor from custom AggregationStrategy in Apache Camel. Is there any way to do this?

Related

using reactive-streams with Apache Camel Saga

I would like to know if it is possible to use reactive streams in Apache Camel. I know reactive-streams is a component from Apache but I couldn't get it to work the way they explain in the documentation. I would like to know if there is any possible solutions available in github that could help me understand apache camel along with reactive-streams except the one's from apache.
I could possibly use Producer Template with reactor-core but the route logic that sits in RouteBuilder configure method would still be blocking I/O. Any helps would be appreciated?

External Service through Component Bindings in Camel (Similar To Mule binding interface)

I'm new in Apache Camel world and currently looking to understand how to use camel endpoints to Java interface methods. As per my requirement, I want to use an external service while the component(bean or transform or a process) is still processing the message. In Mule world - this is how it is implemented -
<component class="org.mule.examples.bindings.InvokerComponent">
<binding interface="org.mule.examples.bindings.HelloInterface"
method="sayHello">
<cxf:outbound-endpoint
address="http://myhost.com:81/services/HelloWeb?method=helloMethod"
synchronous="true"/>
</binding>
</component>
Here in this example - The binding causes the sayHello method in HelloInterface to call out to the external HelloWeb service when sayHello is called when InvokerComponent is in execution.
Currently, I'm reading about camel CXF-RS but not sure if this is way to implement this type of use case in Camel. Can anyone please help me or guide me to implement this? Any code example will be great. Thank you so much!!
It’s quite an old unanswered question so sharing some ideas. You can use aggregator EIP for this situation.
The Aggregator from the EIP patterns allows you to combine a number of messages together into a single message.
https://camel.apache.org/components/3.13.x/eips/aggregate-eip.html
How to use Aggregator EIP using Spring and Apache Camel?
https://youtu.be/IdGuGGVv51Q

What is RouteBuilders in apache camel and what is it used for?

I want to know what is Route-builders in Apache camel? And why is it used for?
I have a project where JMS and apache camel are used but i dont know what is routebuilder.
In advance: I am not 100% sure about the long answer, so please correct me if I am fundamentally wrong here!
Short:
The basic definition given by the official apache camel docu states:
The RouteBuilder is a base class which is derived from to create
routing rules using the DSL. Instances of RouteBuilder are then added
to the CamelContext.
Long:
Routebuilder is an abstract class. When implementing your own route, you usually extend from that RouteBuilder class (as the citation above already stated).
As a consequence you must implement the method configure() in which you implement the route (from()/.to()/.process() etc.)
I am pretty sure it is possible to implement a route without extending RouteBuilder, but then you would have to rebuild the framework given by apache camel. The whole syntax (from()/.to()/.process() etc.) for implementing routes is provided by extending Routebuilder class.
Apache Camel is a framework. In order to use the framework your "route class" must inherit from the base classes of the given framework. Otherwise you would not be able use the framework, which already offers a huge part of the implementation.
If Claus Ibsen answers your question, stick to his answer, he knows virtually everything about apache camel.

Apache camel configuration

I use apache camel-cdi and wildfly 8.2. How to configurate thread pool for camel?
In documentation I only see config for spring, but I use java ee with wildfly
You can check Java DSL configuration to create a thread pool in Camel.
import org.apache.camel.spi.ExecutorServiceManager;
import org.apache.camel.spi.ThreadPoolProfile;
ExecutorServiceManager manager = context.getExecutorServiceManager();
ThreadPoolProfile defaultProfile = manager.getDefaultThreadPoolProfile();
// Now, customize the profile settings.
defaultProfile.setPoolSize(SomeSize);
defaultProfile.setMaxQueueSize(QueueSize);
This depends on your use case but you can definitely use thread pooling with Camel Java DSL. The format would be something like the below:
ExecutorService threadPool = Executors.newFixedThreadPool(20);
.split(body().tokenize("\n")).streaming().executorService(threadPool)
Individual components can also allow for individual threading (see file2 for example). If you have the Camel in Action book, chapter 10 is all about concurrency. It goes into threading and concurrency in much more detail.

How to add dynamic destinations to camel?

I am new to Apache Camel. I am trying to build a pubsub pattern with Camel. I want to add subscribers dynamically so that a single event can be received by dynamic number of receivers. How can I do that? Thanks.
You can for example use JMS for that. I am its a bit cheap answer. But pub-sub is native supported by JMS.

Resources