I would like to connect my Spring Boot application to a Solace PubSub+ instance using the following URL amqps://localhost:5671. I would like to use Spring Cloud Stream and Solace Spring Cloud Stream Binder for that.
I tried the following configuration in my application.yml:
solace:
java:
host: amqps://localhost:5671
clientUsername: admin
clientPassword: admin
But this does not work. I keep getting errors that amqps is not a valid scheme. Same goes for plain amqp:// URIs.
I have dug a little deeper into the code of Solace Spring Cloud Stream Binder, and I am not sure this is actually possible at all. It seems the configuration above only works for tcp:// and tcps:// URIs, both resulting in messages being sent over Solace's proprietary SMF protocol.
This works:
solace:
java:
host: tcp://localhost:55555
clientUsername: admin
clientPassword: admin
... but does not use AMQP but SMF.
How can I configure Solace Spring Cloud Stream Binder to communicate via AMQP and AMQPS?
The Spring Cloud Stream binders from Solace do not support AMQP. They are written using the Solace Java API JCSMP and use SMF, which you have observed.
I am not sure if there is a community SCS binder using AMQP 1.0. Is there a reason you need it to work in AMQP 1.0?
I have my 2.5.4 grails version application secured by Spring Security and working very well. I need to change that and grant access to the user only if the reply of a rest service allows that. That is, instead of using the spring security functionality of asking for a username/password, I want to call a rest service (that I have already) and if this service replies that the user has access to the application, I want to grant access to this user.
As far as I understand, I need to override the auth method of LoginController of spring security core. Will I also need grails filters?
Could you please provide me with some advice on this topic?
This works for me in BootStrap.groovy running grails 3.1.9. Not sure it will help you, but it might be a starting point.
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken
import org.springframework.security.core.context.SecurityContextHolder as SCH
...
SCH.context.authentication = new UsernamePasswordAuthenticationToken(admin.username, admin.password, admin.authorities)
Have you looked at the spring security rest plugin (version 1.5.3 for grails 2.5.x) and using JWTs to pass around the authentication?
Spring websocket implements SockJs protocol at server and sockjs client can be used to interact with it. Is there any other equivalant library which can be used? We need to send query string with the sockjs comet URL but it seems it is not supported
http://sockjs-tornado.readthedocs.org/en/latest/faq.html
https://twitter.com/majek04/status/376371451005128704
So, more precisely, is there an alternative to sockjs client which supports query string and the goodness of sockjs client -fallback options?
I have raised a question about support for query string in sockjs:
http://stackoverflow.com/questions/31118456/can-i-add-request-parameter-to-sockjs-constructor-so-that-it-can-be-send-to-serv
As the answer of your other question states, yes, this is supported in SocksJS 1.0.0.
And SockJS 1.0.0 will be the default version in Spring Framework 4.2.0.RELEASE, see SPR-12422.
I am new to Grails. I have seen how to expose the controller actions/methods as RESTFull services using UrlMapping.groovy file and using GET/POST/PUT/DELETE http methods.
Now following is my questions.
1.Is there any way exposing the service class methods (/service folder in Grails apps) as RESTFull services and access them in similar way as i accessed the controller actions as described above.
2.Is there a way to expose the service class methods as SOAP services?
You would like to look at JAXRS plugin and CXF plugin and this page for reference, if you have not transitioned to Grails 2.3 yet.
Grails 2.3.0 comes with a renaissance of REST services.
Note
JAXRS plugin will help in achieving what you needed from question # 1 agreeing to the comment from #TP_JAVA about exposing service methods as controller action.
We are looking at using MQTT as the messaging protocol on a new device we're building. We'd also like a web interface for the device. Does anyone know if you can implement a browser client app (without additional plugins) that talks MQTT?
Yes, as mentioned in Steve-o's comment MQTT via websockets is very possible.
There are 2 options at the moment
IBM's MQ 7.5 comes with websockets support, you can find details here.
The Mosquitto broker has a javascript client with an example running here.
To answer your second question lighttpd has a websockets module that can be used to do forwarding to an existing broker with details here.
I've not been able to find anything for Apache that doesn't need you to write your own library to do the forwarding.
To extend hardillbs answer:
There is a third option now:
HiveMQ supports native websockets without the need for any external web server. It works perfectly with the Javascript client of Eclipse Paho.
If you want to try it out, the public MQTTDashboard (which uses HiveMQ under the hoods) supports websockets on port 8000.
Disclosure: I am one of the developers of HiveMQ
IBM has released a WebSockets based JavaScript client. It is open-source on Eclipse Paho.
Git repository:
http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.javascript.git/
Tutorial is here.
https://www.ibm.com/developerworks/community/blogs/c565c720-fe84-4f63-873f-607d87787327/entry/how_to_prog_javascript?lang=en
We've had good experience using WSS, the WebSocket to TCP Gateway (for MQTT). It means running a separate process, but that does avoid having to change Apache's configuration. WSS also has support for TLS.
Not Apache, but you can follow this guide to install lighttpd with mod_websocket,
http://oriolrius.cat/blog/2013/09/25/server-send-push-notifications-to-client-browser-without-polling/
but for easy of use I highly recommend HiveMQ, as #Dominik recommends.
The blog by jpmens is a good starting point to get mosquitto setup with websocket feature. He's client javascript code based on Paho is on github.
This blog "How to run your web server and MQTT WebSockets broker on the same por" explains two ways for the server side:
mosquitto with http configuration
apache+mod_websocket_mosquitto
Why not nodejs + socket.io? They come with all gadgets included (webscokets, pub/sub, webserver,mqtt broker...).
SocketCluster is another good starting point.
This link (Download codes) is useful. Download it and modify this file mosq-mqttws31.html. Instead of the embedded java script library use this cdn
https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.js
and the client instantiation should be client = new Paho.MQTT.Client("test.mosquitto.org", 8080,"myclien256tiddd_" + parseInt(Math.random() * 100, 10));