Skip to content

Commit 1bf16e2

Browse files
authored
Merge pull request #2292 from marcingrzejszczak/bumpCamel
BUmped Camel to 4.x
2 parents 2b40d47 + 10406ef commit 1bf16e2

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<properties>
2626
<spring-boot.version>4.0.0-M2</spring-boot.version>
2727
<!-- Align it also in Docker image under [docker/spring-cloud-contract-docker/project/gradle.properties] -->
28-
<camel.version>3.22.4</camel.version>
28+
<camel.version>4.14.0</camel.version>
2929
<jsch-agent.version>0.0.9</jsch-agent.version>
3030
<spring-cloud-build.version>5.0.0-SNAPSHOT</spring-cloud-build.version>
3131
<spring-cloud-zookeeper.version>5.0.0-SNAPSHOT</spring-cloud-zookeeper.version>
@@ -125,7 +125,7 @@
125125
</dependency>
126126
<dependency>
127127
<groupId>org.apache.camel.springboot</groupId>
128-
<artifactId>camel-rabbitmq-starter</artifactId>
128+
<artifactId>camel-spring-rabbitmq-starter</artifactId>
129129
<version>${camel.version}</version>
130130
</dependency>
131131
<dependency>

tests/samples-messaging-camel/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
<name>Spring Cloud Contract Sample Camel</name>
1515
<description>Spring Cloud Contract Sample Camel</description>
1616
<dependencies>
17+
<dependency>
18+
<groupId>org.springframework.retry</groupId>
19+
<artifactId>spring-retry</artifactId>
20+
</dependency>
1721
<dependency>
1822
<groupId>org.apache.camel.springboot</groupId>
19-
<artifactId>camel-rabbitmq-starter</artifactId>
23+
<artifactId>camel-spring-rabbitmq-starter</artifactId>
2024
</dependency>
2125
<dependency>
2226
<groupId>org.apache.camel.springboot</groupId>

tests/samples-messaging-camel/src/main/java/com/example/BookRouteConfiguration.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import org.apache.camel.CamelContext;
2020
import org.apache.camel.RoutesBuilder;
2121
import org.apache.camel.builder.RouteBuilder;
22-
import org.apache.camel.component.rabbitmq.RabbitMQComponent;
22+
import org.apache.camel.component.springrabbit.SpringRabbitMQComponent;
2323
import org.apache.camel.model.dataformat.JsonLibrary;
2424

25-
import org.springframework.beans.factory.annotation.Value;
25+
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
2626
import org.springframework.context.annotation.Bean;
2727
import org.springframework.context.annotation.Configuration;
2828

@@ -33,22 +33,22 @@
3333
public class BookRouteConfiguration {
3434

3535
@Bean
36-
RoutesBuilder myRouter(final BookService bookService, CamelContext context,
37-
@Value("${spring.rabbitmq.port}") int port) {
36+
RoutesBuilder myRouter(final BookService bookService, CamelContext context, ConnectionFactory connectionFactory) {
3837
return new RouteBuilder() {
3938

4039
@Override
4140
public void configure() throws Exception {
42-
RabbitMQComponent component = context.getComponent("rabbitmq", RabbitMQComponent.class);
43-
component.setAddresses("localhost:" + port);
41+
SpringRabbitMQComponent component = context.getComponent("spring-rabbitmq",
42+
SpringRabbitMQComponent.class);
43+
component.setConnectionFactory(connectionFactory);
4444

4545
// scenario 1 - from bean to output
4646
from("direct:start").unmarshal()
4747
.json(JsonLibrary.Jackson, BookReturned.class)
4848
.bean(bookService)
4949
.marshal()
5050
.json(JsonLibrary.Jackson, BookReturned.class)
51-
.to("rabbitmq:output?queue=output");
51+
.to("spring-rabbitmq:output?queues=output");
5252
}
5353

5454
};

tests/samples-messaging-camel/src/test/groovy/com/example/CamelMessagingApplicationSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import org.springframework.test.context.DynamicPropertySource
4040
*/
4141
// Context configuration would end up in base class
4242
@AutoConfigureMessageVerifier
43-
@SpringBootTest(classes = CamelMessagingApplication, properties = 'camel.component.rabbitmq.declare=true')
43+
@SpringBootTest(classes = CamelMessagingApplication, properties = 'camel.component.spring-rabbitmq.auto-declare-producer=true')
4444
@Testcontainers
4545
class CamelMessagingApplicationSpec {
4646

@@ -82,7 +82,7 @@ class CamelMessagingApplicationSpec {
8282
when:
8383
bookReturnedTriggered()
8484
then:
85-
def response = contractVerifierMessaging.receive('rabbitmq:output?queue=output')
85+
def response = contractVerifierMessaging.receive('spring-rabbitmq:output?queues=output')
8686
assert response.headers.get('BOOK-NAME') == 'foo'
8787
and:
8888
DocumentContext parsedJson = JsonPath.

0 commit comments

Comments
 (0)