Need of listening incoming emails using spring boot - 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

Related

Spring Security for Spring cloud stream with RabbitMQ as binder

I have a Spring boot application with Spring cloud stream enabled. This project contains both API endpoints and producer/consumer streams in it. In our case RabbitMQ is the binder. We have enabled Spring security but it works for API endpoints.
I need to know how security can be enforced for stream requests coming from RabbitMQ. Since no user context involved in this and the other services are publishing their requests to queue (our cloud stream has listeners for that queue) and not directly calling the API. So i am not sure how client credentials flow can be used in it.
#Vignesh
Now I'm not sure is it possible to share user content from message producer to message consumer.
I created an issue: https://github.com/Azure/azure-sdk-for-java/issues/23323
Please vote for the issue if you think this is necessary for you.
You can click +1 to vote, or you can add comments in the issue.
Further discussion in the issue is welcome.

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

Implement Jax ws in vertx with spring

I am trying to implement a soap service using jaxws with spring boot and vert.x. I couldn't find any way of doing it directly. Need to wrap ws in vertx. Have anyone faced it and could any one help me guiding to reference. Can we use service discovery in vert.x for the same?
I don't think that vert.x is a relevant solution to expose SOAP webservices, it's more appropriate to write Restfull or event based microservices (with the native event bus or a messages broker like Apache Kafka).
If you want to consume a SOAP webservice, I assume that you can use a CXF or Axis client like any java application.
Otherwise I didn't understand the relationship with springboot.

Is a HTTP server(Jetty) required for hosting camel routes processing HL7 messages

I want to create a HL7 listener in camel and process the HL7 messages I receive. I was planning to use SpringBoot/dropwizard along with camel for this purpose. The reason dropwizard is already used in my company for creating restful API's and I thought of reusing them for creating Camel routes as microservices also. My questions are,
HL7 messages are received using MLLP(Mina or Netty) over TCP. There isnt any HTTP involved. So is there any purpose of using a server like Jetty? Is it better to use Camel standlone?
If there is not any HTTP requests/listeners involved in my camel application, is there any use of me going for dropwizard/Springboot, as these frameworks were mainly created for creating Restful API's i.e for HTTP traffic?
Ad 1)
Yes HTTP is not involved and Camel uses Netty (preferred) or Mina.
Mind there is camel-mllp which is a more hardened than camel-hl7 which has some more advanced HL7 corner cases fixed. See the readme file: https://github.com/apache/camel/tree/master/components/camel-mllp
Ad 2)
You can opt out HTTP in spring boot, just dont have its -starter-web dependency and its a standalone non HTTP app. Just mind that you may need to turn on camel.springboot.main-run-controller=true in the application.properties to keep the JVM running.
And by using Spring Boot or DropWizard etc you have a similar deployment and packaging as other apps, instead of having to create something yourself.

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