Spring Integration is there an advice-handler equivalent for http:inbound-gateway? - spring

Thanks to a previous question answered here on stackoverflow, I was able to set up a mechanism for logging calls to http:outbound-gateway using an advice chain added to the gateway. ( Spring Integration AOP for Logging outbound Http requests ). Now I'm looking for something equivalent for http:inbound-gateway that would allow me to log inbound HTTP calls. Any ideas would be appreciated.

You could add a wire tap to the gateway's request channel.

Related

Need of listening incoming emails using spring boot

Looking for some ideas on how to retrieve incoming emails (Exchange Server) for processing, like retrieve some information and invoke a web service. The service should constantly listening for new emails. So far we are looking into this using Spring Boot, and Apache Camel or Sprint Integration. Cannot find a clear example on this.
Hope someone help on this.
Have a look at the this API -
https://www.independentsoft.de/jwebservices/tutorial/findmessages1.html
You can create Spring scheduler to poll the exchange server to get the messages arrived in given time interval.
See Spring Integration documentation about e-mail support: https://docs.spring.io/spring-integration/docs/current/reference/html/mail.html#mail.
The MailTests can serve as a good sample how to configure Spring Integration channel adapters for e-mail polling: https://github.com/spring-projects/spring-integration/blob/main/spring-integration-mail/src/test/java/org/springframework/integration/mail/dsl/MailTests.java.
The Spring Boot environment doesn't matter at this point: there is no any auto-configuration for mail polling, so everything should be transparent as long as as you use Spring Integration recommendations.
Unfortunately the official sample we have is still an XML, but should give you some ideas what and how should be configuration for IMAP or POP3: https://github.com/spring-projects/spring-integration-samples/tree/main/basic/mail

How do we design a spring integration system where from the first call response we will have to decide which gateway to follow

**Spring Integration:**Need to design a system where from the first call response it will be decided which gateway to go to in the spring integration.
Was trying to implement first gateway as the common call then another gateway to segregate the different gateway calls. As we need gateway for the first interaction.Looking for other better design than this.
I cannot post the code in here due to security reason but i think using gateway for the first interaction and then based on the response if we use the router for segregating the call would help over here. Thanks!!

Hystrix Circuit Breaker Implementation be at Zuul API Gateway Level or at REST API Service Level

For Example, I have two Rest Api services running
https://my-app-one.com/get
https://my-app-two.com/update
After Zuul API Gateway Implementation the requests will be routed to
Zuul Proxy:
Proxy 1 : https://zuul-api-gateway.com/get
Proxy 2 : https://zuul-api-gateway.com/update
Questions:
Can we implement Hystrix Dashboard at Zuul API gateway level?
Can we utilize all Hystrix commands if implemented at API gateway level?
What are the challenges and please provide documentation or examples.
I already have a working example of Hystrix Circuit Breaker and Hystrix Dashboard. All I want to know is if I can move Hystrix implementation at Zuul API gateway level.
#IMNash: Unfortunately, I cannot comment to your original question so I am afraid I have to ask you via an Answer. I am terribly sorry that I need to do that but I don't have enough reputation points yet.
Is it mandatory for you to go the Zuul way? If not, you might want to consider using Spring Cloud Gateway. The relevant post from Baeldung is an eye opener. See the below snippet:
//...route definition
.route(r -> r.path("/articles")
.filters(f -> f.hystrix("some-command"))
.uri("http://baeldung.com")
.id("hystrix_route")
I have tested this myself and yes, it's that easy to apply Hystrix.
The next step would be to configure the Hystrix filter as per your needs (e.g. timeouts, max semaphores, etc.).
I think we can only implement hystrix at individual rest service level. we can't implement hystrix at zuul routing level.

Consuming CometD messages with spring webflux

We have a system which publishes messages via cometD.
I wrote a simple java program to establish a connection to the server
then use the bearer token returned from the login to and consume messages
But I want to move this to a Webflux project, but unsure where to start, I can see there is out of box JMS-webflux wrapper, can I use this or is it best to build something similar ?
I'm very new to cometD and have only used simple webflux components,
I can also just use Spring boot, but ideally just like a JmsReceiver or similar
Thanks

Spring Integration - HTTP gateway and JMS

I have a requirement where client sends an HTTP requests, our application processes it and generates response and sends back the HTTP response. The request and response need to be persisted on JMS queues. In order for us to leverage Spring integration in this scenario, can we use spring integration HTTP gateways in place of our current MVC controllers ? Would I need separate gateways for each different uri mapping ? Can the HTTP gateway be integrated with JMS channels ? I would appreciate some ideas on the high level architecture using Spring Integration for this scenario.
Thanks.
The fastest on-ramp would probably to inject a Messaging Gateway (<gateway/>) into your existing controller; if you are simply archiving the request/response, you just need a simply gateway method that returns void and in the Spring Integration flow, wire the <gateway/> to a <jms:outbound-channel-adapter/>.

Resources