0

I have an old Camel 2 with the old Spring Framework 4 app. It has been working for many years. I am upgrading it to Spring Boot 3 and Camel 4.5.0.

It has an amqp XML bean.

<bean id="alarmq" class="org.apache.camel.component.amqp.AMQPComponent">
   <constructor-arg value="${amqPoolConnFty}"/>
</bean>

A Camel route in the app references that AMQP component using the bean id alarmq in the endpoint

from("alarmq:queue:alarm-dispensary")
 .id("alarmeater")
 .to("direct:blahblah")

1st question

  • Where is the Camel document that says you can use a bean id as component spec of the url of an endpoint?
  • what is the pattern of an endpoint with a bean ref

I would like the answer only for Java DSL. It is not helpful for me to know how to configure Camel in XML.

2nd question

I need to translate the AMQP XML bean to @Bean in Java configuration.

I am thinking the Java bean should look like this

@Bean("alarmq")
@Inject
AMQPComponent getAMQPComponent(JmsPooledConnectionFactory jmsPoolConnFty) {
    AMQPComponent amqp = new AMQPComponent(jmsPoolConnFty);
    amqp.setConcurrentConsumers(5);
    return amqp;

}

Will Camel recognize the @Bean name as it recognizes the XML bean id, so that I could use the bean name in the from endpoint, like the XML bean id is used?

If not, how shall the AMQP component Java @Bean be structured?

Answers should be applicable to Spring Boot 3 and Camel 4.5.0.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.