Camel-Netty ReadTimeout Event handler not triggered - apache-camel

I am trying to use camel-netty for TCP Sync communication. I configured requestTimeout to be 5000 ms but event is not triggered. it is continuously waiting for response from server.
Note: With with default codec (textline codec) it is working fine.
Issue arises only when I add custom decoder / encoder to suit my requirement
Camel Version: 2.14.0
Netty Version - 3.9.4

Related

cannot connect to "mqtt://test.mosquitto.org" from React client

I want to connect a client React app to the mosquitto test server. The "meat" React code involved:
import mqtt from 'mqtt';
const mqttConnect = ("mqtt://192.168.1.157",{clientId:"mqttjs01"}) => {
setConnectStatus('Connecting');
console.log(mqttOptions)
setClient(mqtt.connect(host, mqttOptions));
};
The error on the web page is:
ws.js:108 WebSocket connection to 'ws://test.mosquitto.org/' failed:
so one challenge I see is the insistence of a web socket. (ws protocol). Then another challenge is my ultimate goal is to talk to a mosquitto broker running on a Raspberry Pi (port 1883, which I thought the mqqt:// was addressing). The Raspberry Pi is not using websockets.
It appears clear to me that I am clueless. Any guidance / pointing in the right direction...greatly appreciated. Thank you.
With React you have to use WebSockets (because it effectively runs in the broswers) so your URL should start with ws:// not mqtt://.
Secondly you need to specify a port because there is no default port for MQTT over Websockets (and the WebSockets library will default to port 80)
So having checked the table of port numbers on test.mosquitto.org you should be using:
ws://test.mosquitto.org:8080/
p.s your client id's also probably need to have a lot more entropy (be random) otherwise you'll only ever have 1 connected client.
As for your local setup, you will need to configure mosquitto to listen on 2 different ports:
One for normal MQTT (default 1883)
One for MQTT over WebSockets (any port you want)
e.g. a conf file something like:
allow_anonymous true
listener 1883
listener 9001
protocol websockets
Mosquitto will share the same topic space between both listeners.

How to implement http2 streaming client?

I was looking to create a http2 streaming client in C which is able to connect to server, create stream and keep listening for messages from server on that stream without cancelling the stream unless explicitly cancelled or network issue.
I was trying to implement it via libcurl but seems there is no such support in libcurl, at best what I can do is just make a request with curl and not have a timeout. Then curl will just sit there waiting for the transfer to start or complete, until the server does that. And when one transfer is done, the client can just issue another request and go back to waiting...
But I just want to maintain the stream rather than issuing another request to server after receiving message.
I don't want to use GRPC which provides similar functionality but along with it comes lots of complexity of libs and platform dependencies to be resolved.
Is there any other C based library or any http2 stream reference which I should have a look at?

Silverlight SignalR Client takes longer to stop Connection on Self Hosted SignalR

I am using SignalR Self Hosted Service(V 2.2.0) as server and using Silverlight as SignalR Client.
I am able to connect to the server and able to exchange the messages. I am having a button to stop connection to the SignalR service.
What I want is, When I click this button, Connection of that Client should get disconnected from SignalR Hub. I am able to get disconnected from SignalR Hub but it takes so much time to respond and my Client(Silverlight Web Application) gets into unresponsive state and comes back after around 28-30 secs. Is there any way to disconnect client immediately once the button is clicked?
This is because of a deadlock. SignalR client blocks the thread when sending the Abort request. However Silverlight wants to send the request on the UI thread. The default timeout for stopping the connection is 30 seconds so after the timeout the thread is unblocked and execution continues. This can be worked around by invoking stop asynchronously (await Task.Factory.StartNew(() => hubConnection.Stop());) or making the timeout smaller.
TL;DR;
https://github.com/SignalR/SignalR/issues/3102
I resolved my problem by calling hub disconnect method in Silverlight Threading task. So now I do not worry about acknowledgement of hub disconnect from SignalR.

Camel transaction handler forces reconnecting to ActiveMQ

Trying to set up a route with transaction handling on a camel, this leads to connection to the activeMQ drop and reconnect every few milliseconds is this expected, is there a work around?
Logs showing repeatedly reconnecting to ActiveMQ server:
ActiveMQ FailoverTransport Successfully connected to ssl://serveraddress:61617
ActiveMQ FailoverTransport Successfully connected to ssl://serveraddress:61617
ActiveMQ FailoverTransport Successfully connected to ssl://serveraddress:61617
Changed connection factory to use CachingConnectionFactory, also tweaked configurations to incorporate caching connection.

I have to send 2 signals to send a message immidiately in IE and Firefox (SSE)

I'm developing a signalr app having a silverlight client and my project structure is
A web app having the server (hub)
a wpf app having the wpf client (for the first client)
a web app for the other web (silverlight) clients
The problem I'm having is that when I try to send a message to other clients in one of the web clients using Firefox or IE, I need to wait around 2 seconds. But if I send another signal or 2 signals in the same time, It works fine. I can assure that my signals are sent on time only if I send 2 messages.
Could this be because of the transport or sthg that I need to configure? Clients are working fine with Chrome.
OK. Forcing the transport to Longpolling has solved my problem.
here is how I start the connection
IClientTransport transport = new LongPollingTransport();
await HubConnection.Start(transport);
You are correct, we have documented the issue on the release notes
Server sent events has known issues on Silverlight
Messages are delayed when using server sent events on silverlight. To force long polling use the following:
connection.Start(new LongPollingTransport());

Resources