Baggage Propagation in Jms using Spring Cloud Sleuth - spring-boot

I'm trying to use the baggage propagation offered by Spring Cloud Sleuth. In the calls that use the Feign client I don't have any kind of problem, I can propagate custom fields, while while using JmsTemplate of Spring JMS I can't propagate the same fields.
My application is a Spring Boot application, version 2.1.5, with Spring Cloud version Greenwich.SR1.
In order to put the custom fields, I use
ExtraFieldPropagation.set("communicationId", "123456");
while, inside my application.properties, I put
spring.sleuth.baggage-keys= communicationId
I expect that the same functionality present for the Feign client, is also present for the producer JMS. Where am I wrong?

Related

error handling spring boot kafka library feature

I want to include a feature in my spring boot Kafka library which enables the user to just call a listener which includes a retry logic for the messages which are getting failed.Help me with that.

What is the equivalent object of Exchange (Camel) in Spring Boot?

I am trying to migrate an application built with Camel in Spring Boot, but i'm not using the Exchange object of Camel, so i have to use some other object to do the work of Exchange. Can anybody give me an idea about that?
SpringBoot is not an integration framework like Camel. Spring Integration is the counterpart of Camel in the Spring ecosystem. Although SpringBoot and the Spring framework works very well with Camel too.
However, the Camel Exchange is a Camel concept. I think there is nothing similar in Spring Integration.
The Camel Exchange is like an internal, enriched message. A wrapper around an in- and out-message (out is deprecated since Camel 3) and it holds additional state information such as Exchange properties (non-routable headers), Exceptions etc.
As far as I know, in Spring integration there is just the message. No wrapper around it.

Spring Boot Rest Controller vs Camel rest dsl

I'm developing a new application which is Spring Boot with camel. I am exposing REST endpoints as part of this application.
I'm little confused to choose between these two options:
Spring Rest Controller --> Spring service with producer template to call camel routes --> Camel routes for EIP
Camel Rest DSL --> Camel routes for EIP
Can you please help me to choose better option?
This is your call which should you want to implement, But as you are integrating camel in spring boot so you can take advantage of REST DSL camel components and bind that flow with other components of Apache Camel, it will reduce your additional work in spring boot app to send and receive data in your other camels routes.
Here is a sample CRUD rest operations using REST DSL of apache camel component.
rest("/users").description("User REST service")
.consumes("application/json")
.produces("application/json")
.get().description("Find all users").outType(User[].class)
.responseMessage().code(200).message("All users successfully returned").endResponseMessage()
.route()
.to("bean:userService?method=findUsers")
.endRest()
.get("/{id}").description("Find user by ID")
.outType(User.class)
.param().name("id").type(RestParamType.path).description("The ID of the user").dataType("integer").endParam()
.responseMessage().code(200).message("User successfully returned").endResponseMessage()
.route()
.to("bean:userService?method=findUser(${header.id})")
.endRest()
.post().description("Create a user").type(User.class)
.param().name("body").type(RestParamType.body).description("The user to create").endParam()
.responseMessage().code(204).message("User successfully created").endResponseMessage()
.to("bean:userService?method=create")
}
You can check the fully above sample app of spring boot and camel rest dsl from here

Spring cloud sleuth with Spring data jpa

We are trying to implement Spring cloud sleuth with Zipkin in our project and wanted to know if Spring cloud sleuth will support DB calls with Spring data JPA.
I want to trace the time taken for DB calls just like service calls
When I make a service call with RestTemplate, that gets sent to zipkin and I am able to see that on the dashboard
But DB interactions with Spring data jpa is not getting displayed in Zipkin
You can use the new Dalston feature of using annotations on Spring Data repositories. You can check out this for more info http://cloud.spring.io/spring-cloud-sleuth/spring-cloud-sleuth.html#_managing_spans_with_annotations

Spring cloud contract - integrating with non - spring endpoint

I have a spring webapp that communicates with external service over kafka. IS it possible to somehow test contract between those services?
Yes you can. Spring Cloud Contract supports CDC with messaging. If you're using Spring Cloud Stream - the work to be done is trivial. If not then you'll have to implement your own as presented in this issue - Spring Cloud Contract and plain Spring AMQP . Summing it up it's enough for both consumer and producer to implement a custom org.springframework.cloud.contract.verifier.messaging.MessageVerifier bean that will be responsible for receiving and sending of messages via Kafka

Resources