Spring queue web service for tasks that take about 1 minute - spring

I need to create a queue system for a web service in Spring boot. The service needs to do something on the server which takes about 1 minute, then the server will respond with a json to the client.
What do I need to use in Spring in order to achieve this is a reliable way?

It would be a good start if you read the documentation about Spring Boot RESTfull API.
https://spring.io/guides/gs/rest-service/

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

Spring Boot Reactive WebService

We want to build a rest API to service high request volumes. I'm planning to build it using Spring Reactive(WebFlux) or using Spring Boot Async. We have multiple different clients who will be invoking our service.
Do I need to worry about different clients who will be consuming this service? Meaning if I build the API using Reactive or Async, will all the clients be able to consume this seemlessly?
Meaning if build a reactive Rest API, will the client using RestTemplate be able to consume or do they need to use WebClient only?
Yes, your (not non blocking) clients will still be able to consume a reactive service.

How one Jhipster application microservices call in another application..?

I have 1 UAA, 1 gateway and 2 microservices application. How can i call first application rest api to another application.
You need to go much deeper in Jhipster, it is call service discovery of other microservice, a time you init jhisper app it will ask you to add microservices, you can go through below links.
API DOC , Example

Using Gateway to consume Spring Boot application from Spring Integration application

I am just starting with Spring Integration with Spring Boot 2.
I am working on a application which uses Spring Integration's HTTP outbound gateway to consume a Spring boot Service.
I am consuming the spring boot service from Spring Integration application using Gateway.
When I call the Gateway method which in turn will use the outbound gateway to call the spring boot service, the request does not seem to be completed. It is just going on when I make the HTTP GET request via the browser.
The request is also not received by the Spring Boot service.
I am not able to identify what is wrong in my Integration application when using gateway to consume a Spring Boot 2 service.
I have shared my Spring Boot 2 Application and also the Integration application which I am using to consume it in the below github folder. it contains 2 folders, one for the spring Integration application and the other for the spring boot application.
https://github.com/gsamartian/spring-int-demos
I have exposed a REST interface for the Integration application using RestController.
I access the boot application from integration application via the url, http://localhost:8763/callExternalServiceViaGateway
I am able to access the spring boot application directly from its port.
If anyone can help me identify the cause it would be great.
Thanks,
Your problem that the gateway method is without any args:
#Gateway(requestChannel = "get.request.channel", replyChannel = "reply.channel")
String getCustomMessage();
In this case the gateway works as receiving. No any requests is send because nothing to wrap to the payload. See more info on the matter in the Reference Manual.
Right now I see several bugs with the payloadExpression and no arg, so I suggest you to add some String payload arg to the getCustomMessage() gateway method and perform it with an empty string.
Will take a look into the bugs and will fix them soon.
Thank you for a good sample how to catch and reproduce!
https://jira.spring.io/browse/INT-4448
https://jira.spring.io/browse/INT-4449

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.

Resources