How to customize the WebSocket data change event subscription in opendaylight - opendaylight

I'm learning about OpenDaylight and one point that a read in documentation is about to create a websocket for listen to data change event in the datastore (http://docs.opendaylight.org/en/stable-nitrogen/developer-guide/controller.html#websocket-change-event-notification-subscription-tutorial).
The WebSocket urls that's generated with this tutorial send information about the changes in the datastore, these websocket messages are made in XML and they have a tag called Operation, the operation tag can have three values: Created, Deleted or Update.
My question is if there's a method to create a WebSocket connection for this URL: http://:8181/restconf/operational/opendaylight-inventory:nodes where the connection only sends information that have a Created or Deleted operation tag.

Related

Need Sample Spring Websocket Example which includes StompClient and ConcurrentWebSocketSessionDecorator in Java

I have stomp session were multiple threads are trying access the same to session to send the data to websocket server. Due to concurrent threads accessing same session I am getting partial text state from stomp session. Wanted to implement ConcurrentWebSocketSessionDecorator on the stomp session to check whether issue of partial text state error goes of or not, but not getting proper documentation or direction to implement the same.

Why Not Get Channel Info From HTTP Header At The Beginning When Using WebSocket

recently I take "github.com/gorilla/websocket" as the underlying websocket implementation and gin web framework for my project.
I googled many examples and found many people used handshakes for their websocket channels, e.g. they let the client register the channel after the connection is upgraded to web socket and then got the client's identity information from the registration request.
My question is:
from the server side, the server is able to get registration information, such as userId, userName etc., from HTTP Header (before the connection is upgraded to websocket), the only thing to do is letting the client put the identity into into HTTP Headers. Why people don't do it this way, and instead they use the handshake which is much more troublesome?
update
The client is able to open many channels, so we have to register every channel to track their usage. And because we will use the channel to send multiple types of messages and they are distingushed by cmd field in the body, so though we are able to get id information from headers, we still need to get channel usage information from websocket data for all the other commucations except the initial registration. To keep constistency between all messages, we register the channel by websocket data other than http header. Is it that reason??

Websocket from UI connecting to one of the instances for Spring boot application for streaming the data coming on a queue

I have an UI application (displays streaming) which makes a WebSocket connection to the Spring Boot microservice (multiple JVM'S) and this service forwards the request to one of the upstream servers and listens to the responses on a JMS queue coming from upstream server, which then response messages had to be returned to the socket.
Issue we are facing is since the socket is point to point, and the Spring Boot application is running on multiple instances which all are listening to the same JMS queue we are unable to serve the data back to the WebSocket when a message is received on a instance which the request to upstream wasn't made.
Here's the basic flow:
WebSocket -> instance1, instance2, instance3 -> Data provider
Instance1 made the request to data provider.
Data provider sends the data back to the queue
Instance 3 receives the message, but it doesn't have the socket connection to send the data back.
We had an interim solution using correlation id in JMS headers and selectors on the queue however now the data publisher is not able to provide the correlation id to depend on.
Does anybody have a better suggestion to address this?
Since you're using a request/reply pattern with JMS you must either use a correlation ID or a unique temporary queue for the response.
You indicated that, "the data publisher is not able to provide the correlation id to depend on." However, your application actually provides the correlation ID. The "data provider" in this case just needs to take it from the message it receives and put it into the response message. The process only requires 2 method calls by the "data provider" - javax.jms.Message.getJMSCorrelationID and javax.jms.Message.setJMSCorrelationID.
If the "data provider" can't do this then it's doubtful they will be able to accomplish the other option of using a unique temporary queue for the response. However, it's worth explaining in any case. When one of your "instance" servers sends the request message it first needs to use javax.jms.Session.createTemporaryQueue to create a temporary queue and then take the return parameter of that method and set it on the request message using javax.jms.Message.setJMSReplyTo. When the "data provider" receives the message they will get this value using javax.jms.Message.getJMSReplyTo and then send the response to this queue where the "instance" will then retrieve it.
These are the two generally accepted ways to implement a request/response pattern with JMS. I don't know of any other ways to implement such a pattern.

Spring boot Stomp WebSocket multiple session for same user

I have a spring boot application where I am using Stomp over websockets and using RabbitMQ as external message broker. Our application is using spring security as well. Same authenticated user can get logged inn using different browsers. User can subscribe at some destination to fetch live data feeds using Js client of SockJS. At backend we use simpleMessageTemplate.convertAndSentToUser method to push live feeds to particular authenticated user.
Issue we are facing is that when user login using browser A and subscribe to a destination, A Unique queue like data-feeds-user123 is created at RabbitMq with auto-delete policy, and same user login from different browser B but does not subscribe to destination. Now when backend publishes live data feed using convertAndSendToUser method, A strange behaviour happens A new queue is created data-feeds-321 and messages are published at both queues. Although queue data-feed-321 does not have any consumer and it does not gets deleted when user gets disconnected/close session. Such queues seems useless in such scenario and does not get purged automatically.
Can anyone help me out on this, I don’t want to broadcast the messages unless user subscribed from JS client.

Design of queues with JMS & QPID

I am currently assigned the task of writing an application which will use JMS API to communicate using Apache qpid as the JMS provider.
so basically my application will have multiple instances of a server running.Each server will serve a set of unique desks.so each instance will only have data for the desks it is serving.
There will also be multiple instances of clients each configured by desk again.
Now when the client starts up, it will request the data for the desk it is serving to the servers.The request should only go to the server that has that desk data loaded and the response should only go back to the client who requested the data for that desk.
I am thinking of using queues for this.i am not sure if i should create only one request queue which will be used by all the servers or i should create seperate queues for each server.
For response ,I am planning to use temporary queues.
Not that the request from the client to the server is not very often.Say each client may send around 50 requests a day.
can someone please tell me if this is a good design?

Resources