java - How can read message from rabbit and return boolean value? -
i have built code sender message client java , c# using rabbit. have this:
public boolean isnaoconnect() { bool isconnect = false; string azione = "checknao.java:&&{"; //immetto parametri di tipo stringa azione += "}&&{"; //parametri di tipo int azione += "}&&"; var messagebody = encoding.utf8.getbytes(azione); channel.basicpublish("", "astro", null, messagebody); var consumer = new eventingbasicconsumer(channelresponse); consumer.received += (model, ea) => { var body = ea.body; var message = encoding.utf8.getstring(body); if (message != null && message.equals("true")) isconnect= true; }; channelresponse.basicconsume(queue: "astro_response", noack: true, consumer: consumer); console.readline(); return isconnect; }
if client java send message true, method isnaoconnect should return true else false. can read message can't return true or false code. how can fix it?
Comments
Post a Comment