Our Telnet Service is a simple service that opens a port, accepts telnet connections and treats commands typed in the terminal as method invocations. The message listener interface determines which commands are available, the MDB supplies the logic of what these commands do, the Connector takes care of the rest.
A user will connect with a telnet client which will cause our resource adapter to ask the container for an instance of the MDB. We will let the user invoke the MDB as much as he or she likes. When the telnet client exits, the connection is closed and the the MDB is destroyed.
TomEE 8
mvn clean compile install ; (cd ear-module/ ; mvn tomee:run)Liberty/OpenLiberty
mvn clean compile install ; (cd ear-module/ ; mvn liberty:run)Simple Implementation:
@MessageDriven
@Prompt("pronto>")
public class SystemMDB implements TelnetListener {
@Command("os")
public String getOsType() {
return System.getProperty("os.name");
}
}