Presentation is loading. Please wait.

Presentation is loading. Please wait.

Eike Stepper ES-Computersysteme Berlin, Germany Net4j Signalling Platform Developing Pluggable Client/Server Applications.

Similar presentations


Presentation on theme: "Eike Stepper ES-Computersysteme Berlin, Germany Net4j Signalling Platform Developing Pluggable Client/Server Applications."— Presentation transcript:

1 Eike Stepper stepper@esc-net.de http://www.esc-net.de ES-Computersysteme Berlin, Germany Net4j Signalling Platform Developing Pluggable Client/Server Applications

2 Agenda 1.Requirements 2.Architecture  Buffers  Channels  Connectors  Acceptors  Protocols  Signals Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.02 3.Examples  Request  Indication  SignalProtocol  Client Usage 4.Discussion

3 Requirements  High performance  java.nio.DirectByteBuffer, zero copying  Good scalability  java.nio.channels.Selector, single I/O thread possible  Multiple physical transports  Shipped with TCP, HTTP and JVM transports  Pluggable application protocols  Independent of chosen transport  Server-initiated push services (agent paradigm)  Asynchronous and synchronous requests from the server  OSGi and stand-alone modes Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.03

4 Architecture Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.04 Acceptors OSGi / Eclipse TCP Utils Buffers Channels Connectors Signals Protocols JVM App 1 App 2

5 Buffers Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.05 IBuffer IBufferProvider IBufferPool extends IBufferHandler handles BufferState BufferInputStream BufferOutputStream reads writes

6 Channels Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.06 IChannel IBufferHandler receiveHandler IChannelMultiplexer ChannelInputStream ChannelOutputStream reads writes BufferInputStream BufferOutputStream extends

7 Connectors Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.07 ConnectorState IConnector TCPConnector ConnectorLocation implements IChannel IBufferHandler extends creates JVMConnector IChannelMultiplexer

8 Acceptors Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.08 IAcceptor TCPAcceptor implements IConnector accepts JVMAcceptor TCPConnector JVMConnector creates implements

9 Protocols Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.09 Protocols IProtocol IProtocolProvider IBufferHandler extends provides server protocolprovides client protocol IChannel uses

10 Signals Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.010 SignalProtocol Signal IProtocol implements SignalActor SignalReactor Request RequestWithConfirmation Indication IndicationWithResponse creates Thread extends runs in

11 // Start a TCP acceptor that is configured through extension points IAcceptor acceptor = TCPUtil.getAcceptor(IPluginContainer.INSTANCE, "0.0.0.0:2036"); // Open a TCP connection that is configured through extension points IConnector connector = TCPUtil.getConnector(IPluginContainer.INSTANCE, "localhost:2036"); // Open a channel with the JMS protocol JMSClientProtocol protocol = new JMSClientProtocol(infraStructure); IChannel channel = protocol.open(connector); channel.addListener(channelListener); // Create a logon request and send it through the channel JMSLogonRequest request = new JMSLogonRequest(protocol, "user", "pw"); boolean ok = request.send(); Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.011 Client Example

12 Request Example public class JMSLogonRequest extends RequestWithConfirmation { private String userName; private String password; public JMSLogonRequest(JMSClientProtocol protocol, String userName, String password) { super(protocol); this.userName = userName; this.password = password; } @Override protected short getSignalID() { return JMSProtocolConstants.SIGNAL_LOGON; } @Override protected void requesting(ExtendedDataOutputStream out) throws IOException { out.writeString(userName); out.writeString(password); } @Override protected Boolean confirming(ExtendedDataInputStream in) throws IOException { return in.readBoolean(); } Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.012

13 public class JMSLogonIndication extends IndicationWithResponse { private boolean ok; @Override protected short getSignalID() { return JMSProtocolConstants.SIGNAL_LOGON; } @Override protected void indicating(ExtendedDataInputStream in) throws IOException { String userName = in.readString(); String password = in.readString(); ok = JMSServer.INSTANCE.logon(userName, password); } @Override protected void responding(ExtendedDataOutputStream out) throws IOException { out.writeBoolean(ok); } Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.013 Indication Example

14 public class JMSServerProtocol extends SignalProtocol { public String getType() { return JMSProtocolConstants.PROTOCOL_NAME; } @Override protected SignalReactor doCreateSignalReactor(short signalID) { switch (signalID) { case JMSProtocolConstants.SIGNAL_SYNC: return new JMSSyncIndication(); case JMSProtocolConstants.SIGNAL_LOGON: return new JMSLogonIndication(); } return null; } Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.014 SignalProtocol Example

15 public final class JMSServerProtocolFactory extends ServerProtocolFactory { public static final String TYPE = JMSProtocolConstants.PROTOCOL_NAME; public JMSServerProtocolFactory() { super(TYPE); } public JMSServerProtocol create(String description) { return new JMSServerProtocol(); } Net4j Signalling Platform | © 2008 by Eike Stepper, Berlin, Germany | Made available under the EPL v1.015 ProtocolFactory Example


Download ppt "Eike Stepper ES-Computersysteme Berlin, Germany Net4j Signalling Platform Developing Pluggable Client/Server Applications."

Similar presentations


Ads by Google