Does anyone knows if RabbitMQ supports an unix socket connection instead of TCP ? I ask this because all my producers and consumers are all on the same machine.
Thanks !
This is currently not possible - RabbitMQ only allows TCP connections[0]. If you really need to use unix sockets I think redis allows it over unix socket.
[0] https://www.rabbitmq.com/configure.html
Related
Can I simulate a TCP client/server interaction using Apache NiFi processors alone or do I have to write code for this? The processors to be considered here are ListenTCP, PutTCP, and GetTCP. In particular, I want to simulate and show a POC for sending HL7 messages from a TCP client to a TCP server. Anyone done this before using NiFi? Any help would be appreciated. Thanks.
ListenTCP starts a server socket waiting for incoming TCP connections. Your client can make connections to the hostname where NiFi is running and the port specified in ListenTCP. If your client needs to send multiple pieces of data over a single connection, then it must send new-lines in between each message. You can simulate a client in NiFi by using PutTCP and pointing it at the same host/port where ListenTCP is running.
UPDATE - Here is an example of the flow:
I have 2 Brokers and in specific scenario i want to force the client to connect the a specific broker.
How can I achieve it without dropping the other Broker while using the Failover mechanism ?
You can use the priority backup feature of the failover URI to indicate a preference for a specific broker which it try and stay connected to, if that broker goes down it will fail to any other broker that you have configured and keep trying to reconnect to the priority backup in the background.
I have the same requirement, frequently. For clarity, I use failover with two brokers A and B, A is currently the primary and I have an issue requiring a restart. I want to cause all sending clients to connect to B while I leave the consumers to empty the queues on A, when the queues are empty I restart A.
The only way I've found to do this is to close the activeMQ port on A then my sending clients connect to B and my consumer on A (running on the same machine fortunately) can empty the queues. As well as closing the port it seemed I had to also execute
iptables -I INPUT -p tcp --dport -j REJECT
YMMV
We can simply use redis to achieve the remote communication such as:
redis.StrictRedis(host=REDIS_IP,port=PORT)
I don't know whether redis achieve the remote and local in same pattern ?
Maybe I just want to know how redis achieve network communication and inter-process communcation in different way?
If there is something wrong, please point out. Thanks
Redis can handle classical TCP sockets, but also stream oriented unix domain sockets.
TCP sockets can be used to perform both network and local inter-process communication. Unix domain sockets can only support local inter-process communication.
Both kind of sockets are materialized by file descriptors. Redis is based on an event-loop working at the file descriptor level, so it processes TCP and unix domain sockets in the same exact way (using the standard network API). You will find most of the related source code in ae.c (event loop) and anet.c (networking).
You can use unix domain sockets to improve the performance of Redis roundtrips when client and server are hosted on the same box. It depends on your workload, but the performance benefit (in term of throughput) of unix domain sockets over TCP sockets is typically around 1.5 (i.e. you can process 50% more operations when using unix domain sockets).
I'm having problems figuring out how to use the Jedis library to connect to a redis socket connection.
I know how to connect through a network port:
Jedis jedis = new Jedis("localhost");
//Jedis jedis = new Jedis(unix_socket_path="/tmp/redis.sock");
But the socket connection(second in the list) doesn't work. The commands looked simlair to redis-py(python client) but when I tried the same syntax it didn't work. I also looked through the jedis sourcecode on github but couldn't see anything. Any ideas?
I don't think Jedis support unix domain sockets.
The constructor with a single parameter only accepts a hostname (using default TCP port).
Java is portable. It is supposed to provide the same API on different platforms. Unix domain sockets are specific to Unix/Linux. So the Java standard API does not support unix domain sockets. There are separate Java packages for this, but AFAIK, Jedis do not use them.
I have rather simple UDP server written on c.
Sometimes i need to know current length of all udp packets(bytes) queued in socket.
As i understand, getsockopt doesn't get such information.
Linux and FreeBSD solutions are both welcome, thanks!
ioctl(FIONREAD, ...) should be roughly what you are looking for,
http://www.daemon-systems.org/man/ioctl.2.html
From outside of the server (command line), you can do
netstat -uln
which will show you the length of all listening udp sockets.