Integrating Spring MVC with Spring Integration - spring-mvc

I'm trying to connect my existing Spring MVC application with Spring integration but I can't find how to send a TCP message to an specific client.
I have lot of devices connected to my server over TCP and I'm using DirectChannel to get them connected.
Is there any way to specify the client who will receive the message when I call SimpleGatewy.send()?
Thanks.

See the tcp-client-server sample which uses a gateway - this can be invoked from any code, including a controller.

Related

Send notification to other browsers with Blazor

I am writing a blazor server application.
I have a textbox+button in a page and a grid. What i want to do is to allow users to type some text in the texbox. The text should be added to the grid.
What i want is to automatically refresh grid on all browsers when a new message is typed.
I have tried and manage to do that with signalr and signalr hub. It works like a charm.
But i am wondering something: Blazor server creates a signalr connexion between server and browser. My signalr hub is creating a second signalr connexion.
Is there a way to do that without creating a second signalr connexion.
In other words, is there a way to send notifications to browsers without a signalr hub ?
Thanks
I don't know if my view of your problem is correct.
I suspect you're trying to create a direct Signalr connection point-to-point between clients, without any centralized hub.
Right?
If this is the case I think it's impossible using only Signalr, because the server maintains a list of clients ip/port connected to the hub and this list isn't shared between clients.
I don't know if there is any kind of project based on Signalr that enable a Blazor WASM application to expose itself as a server in order to receive communication directly from other WASM Client, but in the world of gaming all is possible !

SignalR Core scaling/hosting

I have some questions regarding SignalR Core on the server side;
My server is written in ASP.NET Core, and it uses SignalR for sending notifications to users. The server uses Controllers with endpoints that clients interact with.
1) Can I host the entire thing in Azure App Service and add the SignalR service to it? Or would it be better to split the SignalR code out to its own server, which is called from the "main" server when needed?
2) The SignalR Service has an option for "Serverless", which according to documentation doesn't support clients calling any server RPCs when in said mode. Could I run this thing in Serverless mode as I'm only using the sockets for sending notifications to the clients. Or is it reserved for Azure functions?
3) Is there a way to get the number of connections for a user in a SignalR hub? I would like to send a push message to the user if he doesn't have any connections to the server. If not - what is the recommended way of handling this? I was thinking of adding a singleton service that keeps count, but am unsure if this would work at scale, especially with the SignalR service.
Thanks.
1) Better use the Azure SignalR.
2) Use it with the hub.
3) If you use Azure SignalR, you can just see it from the portal. In the code, whenever you use Azure SignalR or not, you can save the user Id in some var and count the connections. If you have multiple hubs and servers, you need to do more (if using redis-backplane for example).

How to enable Message Pack protocol in SignalR Azure Functions?

We have an Azure Function supporting a SignalR hub leveraging Azure SignalR Services to publish messages to connected signalR clients. We'd like to enable MessagePack protocol in the function but we could not find any documentation or guidelines to tell how to do it. Any ideas on how to approach this problem?
Interestingly Message Pack protocol is initiated and used when the client app negotiates with the function. Further information can be found here.

Mule 3.5.0 CE creating dynamic inbound endpoints

I am working with a large collection of TCP connections on my mule application and I want to programmatically add inbound endpoints to a composite source.
I have 70+ applications that need to connect to mule where the application is acting as the TCP server and Mule is the TCP client. In Mule 2 there was a way to dynamically add inbound endpoints to the Mule application and this was changed in Mule 3.
Is there a way to add inbound endpoints to one flow or many flows programmatically on mule startup?
I am using Mule 3.5.0 CE. Any input would be greatly appreciated.
You need to implement MuleContextAware and Initialisable. Here is a rough example that does it for a list of JMS queues. It will be fairly simple to change this to TCP:
https://gist.github.com/ryandcarter/c6d612977585c914114d
It programatically creates a Flow and CompositeSource and calls a vm endpoint to get back into Mule config.

Writing HttpService on JBoss

I have written http client using camel http connector. Currently JBoss is chosen as my application server. I would like to write a HttpService that should run on JBoss which can receive and process the payload from client.
Any pointers would be much appreciated.
Thanks in advance
You can have a REST service running on the Jboss server which can be easily built using jersey or resteasy frameworks. Other REST libraries can be used too.
The http service can be built using the plain servlet too. But REST libraries provide a lot of builtin support.

Resources