Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to publish messages via 0MQ from backend server #47705

Open
shreyasdn opened this issue Jan 7, 2022 · 4 comments
Open

Not able to publish messages via 0MQ from backend server #47705

shreyasdn opened this issue Jan 7, 2022 · 4 comments

Comments

@shreyasdn
Copy link

shreyasdn commented Jan 7, 2022

I have a setup where i have a docker image running the pushpin server and have used configuration from the sample file to configure the server. I am able to get and send messages via http but i am unable to publish back messages to the 0MQ SUB socket. Does the SUB socket also require routes file to have a 0MQ line? Can http and 0MQ be used together i.e. get message to backend via http and send message back to pushpin via 0MQ? I have posted the config used below. Also on the pushpin side i am unable to check if the message from the socket has reached, I have turned on the debug mode but am not able to see any activity.

[global]
include={libdir}/internal.conf
[runner]
services=condure,zurl,pushpin-proxy,pushpin-handler
http_port=7999
[proxy]
sig_key=value_is_present
debug=true
# routes config file (path relative to location of this file)
routesfile=routes
# enable debug mode to get informative error responses
debug=false
# whether to use automatic CORS and JSON-P wrapping
auto_cross_origin=false
[handler]
# ipc permissions (octal)
#ipc_file_mode=777

# bind PULL for receiving publish commands
push_in_spec=tcp://*:5560

# list of bind SUB for receiving published messages
push_in_sub_spec=tcp://0.0.0.0:5562

# whether the above SUB socket should connect instead of bind
push_in_sub_connect=false

# addr/port to listen on for receiving publish commands via HTTP
push_in_http_addr=0.0.0.0
push_in_http_port=5561
@jkarneges
Copy link
Member

jkarneges commented Jan 14, 2022

Hi,

The SUB socket is tricky. Nothing will show up in the Pushpin logs unless there is at least one subscribing client. You also need to be careful about the general race condition with ZeroMQ PUB/SUB, which happens if you send too soon after connecting the SUB socket and you've not yet received subscriptions. For example, if you make a simple program that connects to Pushpin and immediately sends a message, it will likely be dropped. The SUB socket is better used by long-running programs. For short-running programs, you should publish via HTTP. If you just want to test sending to Pushpin's SUB socket from a short-running program, try inserting a delay after connecting but before sending a message.

There's no need to do anything with the routes. You can have requests routed to an HTTP backend and still publish via ZeroMQ.

@shreyasdn
Copy link
Author

Hi,
Thanks for the answer i am providing a 3 seconds delay to the PUB socket but still no success. Also just so that i have understood correctly the pushpin server itself subscribes for updates to any channel it send out right?

@jkarneges
Copy link
Member

That's correct. You could try using https://github.com/fanout/pushpin/blob/master/tools/monitorsubsock.py (requires python 2 and pyzmq) to inspect the subscribes/unsubscribes.

@PankhudiB
Copy link

Hello @shreyasdn @jkarneges

I am facing similar problem. Did it work for you ? Any resolution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants