Setup STOMP client in plain java spring - stomp

I am looking for a STOMP example to write server and client both in java spring. Please someone provide me a good simple example.

Currently the Spring Framework does not come with a native Java STOMP client yet, only the server side is provided so far. It is well documented here:
http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp
It seems like there will be a native Java STOMP client in the upcoming Spring Framework 4.2 release (currently due to date is July 1st 2015). It is available in the snapshot already. Just take a look at https://jira.spring.io/browse/SPR-11588
There is a link to the commit adding the STOMP client functionality done by Rossen Stoyanchev.
If you want some examples you can take a look at the tests provided, e.g. WebSocketStompClientIntegrationTests.java.
I hope this helps to get started.

Related

what's the best solution to make kotlin and elasticsearch comunicate

Using google i found two possible solution for now:
-using spring boot with kotlin
-using this kotlin client https://github.com/jillesvangurp/kt-search
I've already finished the android client application in kotlin but now i have to find a way to make this client comunicate with elasticsearch.
What would it be the best solution for my problem that i could look up online
Thanks in advance
First, if you don't use Spring in the current application, integrating it (if possible) would be a lot of work and most likely not worth it.
Another alternative would be to use the officially supported Java client for Elasticsearch (https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/index.html).
BUT, you should keep in mind that, if you put the Elasticsearch client in your client application, that the credentials, you may use, will also be in the client application.
They could be accessible for everyone using the Android client and the user could perform any request on the Elasticsearch. Also you couldn't change them without updating the client.
So, it is likely better to use a Three-Tier-Architecture (https://www.ibm.com/topics/three-tier-architecture) and creating an API service to handle the Elasticsearch requests.

How to consume external websocket API in Apache Camel since ahc-ws deprecate?

ahc and ahc-ws (Async Http Client) components have been deprecated in Apache camel version 3.16: https://issues.apache.org/jira/browse/CAMEL-17667.
Is there an alternative for ahc-ws? The component was very easy to use to consume external websockets API.
Other libraries like Jetty, Undertow, Atmosphere, don't seem to offer this kind of features. I have not been able to configure them and the documentation remains unclear. They only provide the server part.
For the websocket-jsr356 component, I can't configure the component to consume a WebSockets over SSL API (wss). The library seems to support only classic websocket (ws).
I looked for alternatives on the camel doc, examples on github but I didn't find anything.
Is there a viable alternative to ahc-ws to consume external websocket APIs simply with camel?
Thanks a lot
Looks like it's not deprecated yet. There is just a suggestion for that. ahc-wss is very useful currently and there is no viable alternative for the same. websocket component requires tedious tweaking of secure storage parameters and is just kills the purpose of wss. I hope they don't deprecate ahc-wss without a proper replacement though.

Spring Boot JMS client

I have used couple of days trying to find simple example of how to implement a JMS client with minimum possible number of dependencies.
In internet you can find tons of examples. But Spring Boot examples exclusively use local broker. Most of them have ActiveMQ or RabbitMQ starter dependency & nothing else.
I can see that this is a kind of "general question" that Stack Overflow doesn't like, but I can not figure out were to go. No help from Spring docs either.
And I am sure there not very many lines of code are needed if you just know what to do!
EDIT: I just want a JMS listener.

Spring Cloud Zipkin with RabbitMQ not persisting in MYSQL

I have done all the possible matches and mix-up of dependency and still not able to record traces in zipkin ans store it in MYSQL using RabbitMQ.
Still i can see the trace and span id's in console and nothing beyond this.
Someone please take a look at the code in github from below location.
Github code: https://github.com/javayp/distributed-tracing-1
You've mixed almost everything you could have mixed. On the app side you're using both the deprecated zipkin server and the deprecated client. On the server side you're using deprecated zipkin server.
My suggestion is that you go through the documentation https://cloud.spring.io/spring-cloud-static/Edgware.SR3/single/spring-cloud.html#_spring_cloud_sleuth and read that the stream servers are deprecated and you should use the openzipkin zipkin server with rabbitmq support (https://github.com/openzipkin/zipkin/tree/master/zipkin-collector/rabbitmq).
On the consumer side use https://cloud.spring.io/spring-cloud-static/Edgware.SR3/single/spring-cloud.html#_sleuth_with_zipkin_via_rabbitmq_or_kafka . It really is as simple as that. Also don't forget to turn on the sampling percentage to 1.0

Long polling and other fallback support for Websocket using Jetty 9

Can somebody please let me know how i can add long polling and other fallback support for websocket using Jetty 9?
I generally recommend using something like CometD (http://www.cometd.org) which will be releasing version 3 fairly soon which will support Jetty 9. Another option would be to look at the Atmosphere project.
Using a messaging framework like these let you have the framework handle finding the best protocol to use, be it SPDY, Websocket, HTTP/1.1 or even polling HTTP/1.0....and they isolate you from future protocols like HTTP/2 which is coming (slowly) which is based on spdy. Using CometD once that protocol lands and becomes available get it for free, no changes needed in your app.

Resources