How to configure retries in Reactive Spring Integration application - spring

I'd like to configure the retry policy as specified in the reactor documentation but I'm pretty confused by how it'll integrate the error channel concept of Spring Integration.
Can someone give a simple example of how the two integrate? And if not (which I'm fine with it), I'd like to know what is Reactive Spring Integration's alternative for this.
I've been also reading about Spring Integration's retry mechanisms and the page referenced reactive advice, but I didn't really understand how all of this sit together. To sum this confusion to a focused and clear question - how to configure retry policies in Reactive Spring Integration?

Related

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.

how to use Spring Cloud Gateway without Reactive stuff?

I want to create a new project with Spring Cloud Gateway but I don't want all the reactive functionality. for me, it will be fine if the other microservice will be blocking I/O and not Reactive.
how can I do that?
let's say I'm implementing cloud gateway as reactive and all the other MS's as blocking, its a good approach? what are the cons of that?
Spring cloud gateway are built on top of spring webflux and netty and this cannot be changed.
From the reference docs:
Spring Cloud Gateway is built on Spring Boot 2.x, Spring WebFlux, and
Project Reactor. As a consequence, many of the familiar synchronous
libraries (Spring Data and Spring Security, for example) and patterns
you know may not apply when you use Spring Cloud Gateway. If you are
unfamiliar with these projects, we suggest you begin by reading their
documentation to familiarize yourself with some of the new concepts
before working with Spring Cloud Gateway.
Spring Cloud Gateway requires the Netty runtime provided by Spring
Boot and Spring Webflux. It does not work in a traditional Servlet
Container or when built as a WAR.
Spring Cloud Reference Docs
It is perfectly acceptable for a non blocking IO application to make network calls to a blocking IO application. The non blocking IO app will still have all of the benefits of having non blocking IO. It will not consume resources while waiting for responses from network calls to blocking IO applications and in theory should consume less resources and be able to handle more concurrent calls as a result.
Add this :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
then set :
spring.main.web-application-type=reactive
in application.properties

Spring boot Kafka messaging. How to use SpEL to manage handler access

I'm using Kafka in Spring Boot project. There are a lot of benefits in case you have simple flow (to use #KafkaListener, #KafkaHandler) and spring prepares almost everything for development.
In my application I have different handlers for the same message data. I want to use SpEL to manage handlers manipulating header data, but I've not detected corresponding API for that.
So my question: is it possible to manage my handlers via SpEL in case I have special headers for that (Header for example "X-OPERATION_TYPE":"patch")? How?
P.S.
I can make workarounds using GoF Strategy as example, but I hope spring already has solution for that case.
There is not such a "conditional routing" in Spring for Apache Kafka, but you can do that routing manually in the single #KafkaListener with plain if...else or switch.
For more comprehensive routing logic it would be better to take a look into Spring Integration: https://docs.spring.io/spring-integration/docs/5.0.9.RELEASE/reference/html/messaging-routing-chapter.html

Spring Boot Java8 Microservice Simple Message Subscription service

I am new to Microservice and JMS likes to know how can I
create a subscription
read the subscription
Using Spring Boot and JMS
To get started with Spring Boot and JMS use this getting started guide https://spring.io/guides/gs/messaging-jms/
Once you have that sorted then adding the microservices is just a matter of adding the Spring MVC and Rest components which you could first experiment as a standalone project and then integrate with the JMS application.
To get started with Spring Book and Microservices use the getting started guide https://spring.io/guides/gs/rest-service/
JMS not part of Java SE. You need Java EE or Spring.
I'm not sure queues are the best way to solve the problem.
I'd recommend Spring Boot.
Subscription maintenance isn't something that the queue would do.
A simple REST service would manage this nicely. You'll need a persistence layer to save subscription information.

why we use jersey with spring? What are the benefits?

I want to know that why we use jersey with spring and what are the benefits of using it.
I have searched on google but not getting proper answer so i am asking this question here.Sorry because i know my question is old but i am very confused now.
Please suggest me the example of jersey with spring and hibernate.
Thanx in advance.
I use Jersey2 with Spring in one of my projects and in the other Spring MVC4. The advantage of Jersey is its simplicity. If you are creating only RESTful Web services - use Jersey, if you have to generate also some web pages for users, consider to use Spring MVC.
Additionally, I develop my applications on Google Cloud, so the warm up time is very important (if there is a traffic spike, many instances have to wake up in the background to be ready for incoming requests) - according to my tests Jersey is a bit faster than MVC.
Here you have an example of complete configuration:
Integrating Jersey 2 and Spring with Java Based Configuration

Resources