java - Py4j event listener needed -


i've found stomp.py fall behind when volume around 200k messages per hour & jython not option, java message listener i'm looking have python script 'subscribe' messages / events generated java application. have basic gateway working & can make call 'getmessage()' follows:

def do_gateway():      java_gateway = javagateway()     try:         app = java_gateway.entry_point         message = app.getmsg()         len(message) > 0:         print_message(message) 

...

where java method is:

public string getmsg(){         system.out.println("stack size: " + stack.size());         return stack.size() > 0 ? stack.pop() : "";      } 

what need 'subscribe' getmsg() method & have messages 'pushed' events. low rent alternative of above is:

  app = java_gateway.entry_point         while true:             message = app.getmsg()             if len(message) > 0:                 print_message(message) 

i see callback_server detail interface on java side required - have set on java side & as follow on python side i'm missing stuff & it's not doing much:

****java***

public class subscriberentrypoint implements messagelistener, isubscriberentrypoint,      subscriberentrypoint app = new subscriberentrypoint();     gatewayserver gatewayserver = new gatewayserver(app);     gatewayserver.start();     system.out.println("gateway server started");   public interface isubscriberentrypoint {      public string getmsg();  } 

****python***

def do_callback():     try:          gateway = javagateway(start_callback_server=true)          class java:             implements = ['mqtest.isubscriberentrypoint']          message = gateway.entry_point.getmsg()         print_message(message) 

thanks in advance!


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -