sharing data between jaxl process and another process

90 views
Skip to first unread message

Seshachalam Malisetti

unread,
Feb 14, 2014, 6:09:43 AM2/14/14
to ja...@googlegroups.com
Hi,

   I have situation to process the received messages(on_normal_message)  and send back an acknowledgement. My processing of the message may take little extra time to finish, so I am doing this in a separate worker thread( this is handled by phpresque ). Now i have problem to send back to the jaxl connection process about the processed message.
   I tried using redis pubsub by publishing these acks to a channel and by subscribing to the channel from jaxl(this is not a good idea, hard to implement async subscriber).

   It seems that I cant execute anything after ->connect() method. Also that I can use ->send() method only in the callbacks of jaxl. I dont know the best way to achieve the solution. Any help will be most appreciated.

Thanks,
abbiya

Abhinav Singh

unread,
Feb 14, 2014, 6:38:39 AM2/14/14
to ja...@googlegroups.com
Hi,

3 possibilities that I can quickly think of:

1) jaxl client connections can be communicated using unix sockets. See `jaxlctl` which uses unix socket to communicate with running jaxl client procs.

2) redis is not a bad option, but you will have to implement an async redis client (if it doesn't already exists for php yet).
    create a redis client class extending jaxl core socket client class, add the file descriptor to jaxl core io loop.
    handle on connect callbacks from socket client class and subscribe to desired redis pubsub channel.
    by doing this every running jaxl client proc will also receive callbacks everytime data is sent over pubsub channel.
    (see http_client.php for sample code)

3) using sync redis client to poll for a redis key possibly based upon stanza id you want to ack.
    you can use jaxl core ioloop tick callback and over thr you can write your polling logic.

--
Abhinav

--
Documentation: http://jaxl.readthedocs.org/en/latest/index.html
Create a bug/issue: https://github.com/abhinavsingh/JAXL/issues/new
 
You received this message because you are subscribed to the Google Groups jaxl group. To post to this group, send email to ja...@googlegroups.com. To unsubscribe from this group, send email to jaxl+uns...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/jaxl?hl=en-US
---
You received this message because you are subscribed to the Google Groups "jaxl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jaxl+uns...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Seshachalam Malisetti

unread,
Feb 14, 2014, 6:48:20 AM2/14/14
to ja...@googlegroups.com
Thanks Abhinav for quick response. I shall try these options.

Seshachalam Malisetti

unread,
Feb 17, 2014, 11:05:59 PM2/17/14
to ja...@googlegroups.com
Hi Abhinav,

I went to with node js to do this. All my workers are still PHP :) Thanks again.
Reply all
Reply to author
Forward
0 new messages