Package

Source Code of mmiecho

import org.zeromq.ZMsg;

/**
* MMI echo query example
*
* @author Arkadiusz Orzechowski <aorzecho@gmail.com>
*
*/
public class mmiecho {

    public static void main(String[] args) {
        boolean verbose = (args.length > 0 && "-v".equals(args[0]));
        mdcliapi clientSession = new mdcliapi("tcp://localhost:5555", verbose);

        ZMsg request = new ZMsg();

        // This is the service we want to look up
        request.addString("echo");

        // This is the service we send our request to
        ZMsg reply = clientSession.send("mmi.service", request);

        if (reply != null) {
            String replyCode = reply.getFirst().toString();
            System.out.printf("Lookup echo service: %s\n", replyCode);
        } else {
            System.out
                    .println("E: no response from broker, make sure it's running");
        }

        clientSession.destroy();
    }

}
TOP

Related Classes of mmiecho

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.