-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CSB-2644]: rework amqp demo to use connection pooling (#123)
* Adding camel-activemq using openwire example. Excludes Spring Boot's ActiveMQAutoConfiguration in order to configure camel-activemq entirely using camel.component.activemq configuration and not via spring.activemq configuration. * org.messaginghub:pooled-jms is managed by BOM * CSB-2644: rework amqp demo to use connection pooling and configure camel-amqp as much as possible via camel.component.amqp in application.properties rather than Java code * [CSB-2644]: rework amqp demo to use connection pooling and configure camel-amqp as much as possible via camel.component.amqp in application.properties rather than Java code
- Loading branch information
Showing
5 changed files
with
67 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,26 @@ | ||
example project which connects to A-MQ 7 from Fuse 7, using remote A-MQ address | ||
Example project which connects to A-MQ 7, using the standard AMQP protocol. | ||
|
||
There is the code, from that project, which instantiates component, and sends message | ||
|
||
public class CamelRoute extends RouteBuilder { | ||
|
||
@Override | ||
public void configure() throws Exception { | ||
JmsComponent component = createArtemisComponent(); | ||
getContext().addComponent("artemis", component); | ||
|
||
from("timer://foo?fixedRate=true&period=60000&repeatCount=2") | ||
.setBody().constant("HELLO") | ||
.to("artemis:queue:test") | ||
.log("Sent --> ${body}") | ||
; | ||
} | ||
|
||
private JmsComponent createArtemisComponent() { | ||
|
||
ActiveMQJMSConnectionFactory connectionFactory= new ActiveMQJMSConnectionFactory("tcp://localhost:61616"); | ||
connectionFactory.setUser("admin"); | ||
connectionFactory.setPassword("admin"); | ||
|
||
JmsComponent component = new JmsComponent(); | ||
component.setConnectionFactory(connectionFactory); | ||
|
||
return component; | ||
from("timer:bar") | ||
.id("timer-consumer-route") | ||
.setBody(constant("Hello from Camel")) | ||
.to("amqp:queue:SCIENCEQUEUE") | ||
.log("Message sent from route ${routeId} to SCIENCEQUEUE"); | ||
} | ||
} | ||
|
||
Please see pom file, I don't specify pom versions, because they come in the BOM | ||
Please also see the pom file, no need to specify pom versions, | ||
because they come from the imported BOM. | ||
|
||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>artemis-jms-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-jms</artifactId> | ||
<groupId>org.apache.camel.springboot</groupId> | ||
<artifactId>camel-amqp-starter</artifactId> | ||
</dependency> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters