I can’t get my head around how to set up the project so it handles this case. EITHER it’s so simple ( just putting the scripts in the src folder) or it’s not wise to do so? and put them in 3 separate projects
I have three scripts that share the same dependency. They run as separate pids from a cron job but they are connected by ZMQ. So there is a server that receives the data streams and two clients that send data to the server.
They all share ZMQ but cannot be included into one script as they are architected to provide me with choice as to when and where to run the clients.
This is not an architectural question
SO I start the server
using ZMQ
context = Context()
socket = Socket(context, REP)
ZMQ.bind(socket, "tcp://*:5556")
while true
# Wait for next request from client
message = String(ZMQ.recv(socket))
println("Received request: $message")
if message == "END"
println("dying")
break
end
ZMQ.send(socket, "World")
end
ZMQ.close(socket)
ZMQ.close(context)
then another cron job start the next script
using ZMQ
context = Context()
# Socket to talk to server
println("Connecting to hello world server...")
socket = Socket(context, REQ)
ZMQ.connect(socket, "tcp://localhost:5556")
for request in 1:10
println("Sending script one request $request ...")
msg = "script one request $request ..."
ZMQ.send(socket, msg)
message = String(ZMQ.recv(socket))
println("Received reply $request [ $message ]")
end
ZMQ.close(socket)
ZMQ.close(context)
and finally the cron process starts the third program
using ZMQ
context = Context()
# Socket to talk to server
println("Connecting to hello world server...")
socket = Socket(context, REQ)
ZMQ.connect(socket, "tcp://localhost:5556")
for request in 1:10
println("Sending script two request $request ...")
msg = "two request $request ..."
ZMQ.send(socket, msg)
message = String(ZMQ.recv(socket))
println("Received reply $request [ $message ]")
end
ZMQ.send(socket,"END")
ZMQ.close(socket)
ZMQ.close(context)