Websocket support in a web application - spring

I want to develop a web application using websocket.
I have found two solutions for this task:
Using Spring websocket (included in Spring 4) - I am already familiarized with Spring
Using Atmosphere framework - I've read the docs, it seems to be a mature framework.
I want from the websocket framework to provide a fallback-support in case when the
browser isn't HTML5 compliant, also, I need a client-library for android.
I see that Atmosphere provides support for Socket.IO library, which I want to use on
browser client side. I see that Spring websocket provides only SockJS support over STOMP.
Can I use the same library, Socket.IO, in Spring websocket?
Do you recommend me to use Atmosphere + Spring (for building the RESTFul API) in the same
project?
Thank you

I would suggest going for the WebSocket support in Spring. If you are already using Spring, this will give you a similar programming model plus all these features:
Fallback options with SockJS
Subprotocol support with STOMP
Integration with full blown STOMP broker (like RabbitMQ)
HttpSession and WebSocket Session sync (using Spring Session)
WebSocket security (in the upcoming Spring Security 4)
SockJS Java client (for application to application communication and performance testing, haven't tried it on Android yet but might work)
Runtime Monitoring
Active community with fast response times to requests
The WebSocket support has been around since Spring 4, tested and refined for over a year now. A production ready solution which I'm using in my projects.

Related

STOMP Client for Quarkus Websockets

Has anyone found a STOMP client implementation that works with Quarkus Native via web sockets?
I am using Quarkus 2.7.5.Final including io.quarkus:quarkus-websockets-client

Does Spring webflux supports socket.io or sockJs

Following spring webflux documentation
I couldnt but notice that every single example is based on pure websocket.
Does spring webflux supports such browser client libraries such as socket.io or sockjs?
The Spring Framework team is not considering this feature right now in WebFlux. Because of the back-pressure support in reactive streams, the team is considering protocols that would leverage that information.
For example, rsocket support would fit that space and much more. See SPR-16751

What's the difference between application vs service frameworks?

I'm reading tutorial for Apache CXF and I see one of the samples is using Spring framework. Looking at the following example I don't understand how it is different from just using Spring (it seems CXF doesn't add any add'l functionality?) http://cxf.apache.org/docs/writing-a-service-with-spring.html
Apache CXF is a Services Framework which can be used to create web services and support JAX-RS/JAX-WS/SAAJ etc (various specifications for developing Web Services).
From there documentation they support the following:
Multiple Transports, Protocol Bindings, Data Bindings, and Formats
Transports: HTTP, Servlet, JMS, In-VM and many others via the Camel transport for CXF such as SMTP/POP3, TCP and Jabber
Protocol Bindings:SOAP, REST/HTTP, pure XML Data bindings: JAXB 2.x, Aegis, Apache XMLBeans, Service Data Objects (SDO), JiBX
Formats: XML Textual, JSON,FastInfoset
Extensibility API allows additional bindings for CXF, enabling additional message format support such as CORBA/IIOP
Where as Spring is an Application Framework and supports
IOC Container / DI Framework
MVC Framework (Web Applications and Web Services support)
Data/JPA wrappers etc
To make your enterprise application creation experience smooth.

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.

Soap client framework

I have web application on Spring MVC and looking for SOAP consumer - frameworks to be used with Spring MVC. The web app is only the consumer and doesn't host any web service.
Options I am looking for SOAP client are :
1. JAX-WS
2. Spring MVC & Spring-WS
3. Apache Axis or CXF
4. Spring Integration or Camel. Can these be used for consumption of
services too? Won't that be overhead?
What do you suggest? Please recommend the best option if also not in the above list.
Thanks in advance.
Look at this excellent post about this subject.
Which framework is better CXF or Spring-WS?
My advise based on the fact that you only have to develop one client, is to consider making your choice based on your context to optimize your productivity and avoid adding tones of layer and libs in your app:
Pure Java EE app or already using Spring APP
Your current Application Server : Jboss for example already provide a CXF implementation that is very suggested to use
Service providers "age": I have met some problems in calling AS400 or old IBM system webservices. Any client was not working.
Your IDE and Plugins : for example, if you have eclipse, Axis/CXF plugins are very interesting.
Concerning Camel, it is interesting if you have different source and destination like HTTP to JMS.
For Camel, read this post:
What exactly is Apache Camel?

Resources