There are lot of possible options to set for ZMQ sockets. Providing options for all of them does not sound to me like a proper solution. How about builder api that would allow to use Proc for building response_socket and request_socket whenever the new Connection is required (probably for every new thread).
cf = ConnectionFactory.new.request_parser(parser).context(context).request_socket do |sock|
socket.connect(@request_addr)
socket.setsockopt(ZMQ::IDENTITY, @sender_id)
socket.setsockopt(ZMQ::HWM, 100)
end.response_socket do |sock|
socket.connect(@response_addr)
socket.setsockopt(ZMQ::IDENTITY, @sender_id)
socket.setsockopt(ZMQ::LINGER, 5000)
end
There are lot of possible options to set for ZMQ sockets. Providing options for all of them does not sound to me like a proper solution. How about builder api that would allow to use
Proc
for buildingresponse_socket
andrequest_socket
whenever the newConnection
is required (probably for every new thread).