org.jetlang.remote.acceptor

## Class JetlangBaseSession

- java.lang.Object
- - org.jetlang.remote.acceptor.JetlangBaseSession

All Implemented Interfaces:
  JetlangMessagePublisher, JetlangSession

Direct Known Subclasses:
  JetlangNioSession, JetlangStreamSession

    public abstract class JetlangBaseSession
    extends Object
    implements JetlangSession, JetlangMessagePublisher

### Field Summary

Fields
`protected CloseableChannel<HeartbeatEvent>` `Heartbeat`
`protected Object` `id`
`protected CloseableChannel<LogoutEvent>` `Logout`
`protected CloseableChannel<SessionMessage<?>>` `Messages`
`protected CloseableChannel<ReadTimeoutEvent>` `ReadTimeout`
`protected CloseableChannel<SessionCloseEvent>` `SessionClose`
`protected CloseableChannel<SessionRequest>` `SessionRequest`
`protected CloseableChannel<SessionTopic>` `SubscriptionRequest`
`protected CloseableChannel<String>` `UnsubscribeRequest`

### Constructor Summary

Constructors
Constructor and Description
`JetlangBaseSession(Object id)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`org.jetlang.channels.Subscriber<HeartbeatEvent>` `getHeartbeatChannel()`
`org.jetlang.channels.Subscriber<LogoutEvent>` `getLogoutChannel()`
`org.jetlang.channels.Subscriber<ReadTimeoutEvent>` `getReadTimeoutChannel()`
`org.jetlang.channels.Subscriber<SessionCloseEvent>` `getSessionCloseChannel()`
`Object` `getSessionId()`
`org.jetlang.channels.Subscriber<SessionMessage<?>>` `getSessionMessageChannel()`
`org.jetlang.channels.Subscriber<SessionRequest>` `getSessionRequestChannel()`
`org.jetlang.channels.Subscriber<SessionTopic>` `getSubscriptionRequestChannel()`
`org.jetlang.channels.Subscriber<String>` `getUnsubscribeChannel()`
`protected <T> CloseableChannel<T>` `newChannel()`
`void` `onClose(SessionCloseEvent sessionCloseEvent)`
`void` `onHb()`
`abstract void` `onLogout()`
`void` `onMessage(String topic, Object msg)`
`void` `onReadTimeout(ReadTimeoutEvent readTimeoutEvent)`
`void` `onRequest(int reqId, String reqmsgTopic, Object reqmsg)`
`abstract void` `onSubscriptionRequest(String topic)`
`abstract void` `onUnsubscribeRequest(String topic)`
`abstract void` `publish(byte[] data)` publish raw bytes.
`abstract void` `publishIfSubscribed(String topic, byte[] data)`
`abstract void` `reply(int reqId, String replyTopic, Object replyMsg)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.jetlang.remote.acceptor.JetlangSession

`disconnect, publish`

### Methods inherited from interface org.jetlang.remote.acceptor.JetlangMessagePublisher

`publish`

### Field Detail

#### SubscriptionRequest

    protected final CloseableChannel<SessionTopic> SubscriptionRequest

#### UnsubscribeRequest

    protected final CloseableChannel<String> UnsubscribeRequest

#### Logout

    protected final CloseableChannel<LogoutEvent> Logout

#### Heartbeat

    protected final CloseableChannel<HeartbeatEvent> Heartbeat

#### Messages

    protected final CloseableChannel<SessionMessage<?>> Messages

#### ReadTimeout

    protected final CloseableChannel<ReadTimeoutEvent> ReadTimeout

#### SessionClose

    protected final CloseableChannel<SessionCloseEvent> SessionClose

#### SessionRequest

    protected final CloseableChannel<SessionRequest> SessionRequest

#### id

    protected final Object id

### Constructor Detail

#### JetlangBaseSession

    public JetlangBaseSession(Object id)

### Method Detail

#### newChannel

    protected <T> CloseableChannel<T> newChannel()

#### getSessionId

    public Object getSessionId()

Specified by:
  `getSessionId` in interface `JetlangSession`

#### onLogout

    public abstract void onLogout()

#### onSubscriptionRequest

    public abstract void onSubscriptionRequest(String topic)

#### onUnsubscribeRequest

    public abstract void onUnsubscribeRequest(String topic)

#### onHb

    public void onHb()

#### publish

    public abstract void publish(byte[] data)

Description copied from interface: `JetlangSession`
publish raw bytes. The bytes should be correctly formatted with the topic included. The bytes will be published asynchronously, so the byte array should be a thread safe copy of the data.

Specified by:
  `publish` in interface `JetlangSession`

#### reply

    public abstract void reply(int reqId,
                               String replyTopic,
                               Object replyMsg)

Specified by:
  `reply` in interface `JetlangMessagePublisher`

#### publishIfSubscribed

    public abstract void publishIfSubscribed(String topic,
                                             byte[] data)

#### getSubscriptionRequestChannel

    public org.jetlang.channels.Subscriber<SessionTopic> getSubscriptionRequestChannel()

Specified by:
  `getSubscriptionRequestChannel` in interface `JetlangSession`

#### getLogoutChannel

    public org.jetlang.channels.Subscriber<LogoutEvent> getLogoutChannel()

Specified by:
  `getLogoutChannel` in interface `JetlangSession`

#### getHeartbeatChannel

    public org.jetlang.channels.Subscriber<HeartbeatEvent> getHeartbeatChannel()

Specified by:
  `getHeartbeatChannel` in interface `JetlangSession`

#### getSessionMessageChannel

    public org.jetlang.channels.Subscriber<SessionMessage<?>> getSessionMessageChannel()

Specified by:
  `getSessionMessageChannel` in interface `JetlangSession`

#### getReadTimeoutChannel

    public org.jetlang.channels.Subscriber<ReadTimeoutEvent> getReadTimeoutChannel()

Specified by:
  `getReadTimeoutChannel` in interface `JetlangSession`

#### getSessionCloseChannel

    public org.jetlang.channels.Subscriber<SessionCloseEvent> getSessionCloseChannel()

Specified by:
  `getSessionCloseChannel` in interface `JetlangSession`

#### onMessage

    public void onMessage(String topic,
                          Object msg)

#### getUnsubscribeChannel

    public org.jetlang.channels.Subscriber<String> getUnsubscribeChannel()

Specified by:
  `getUnsubscribeChannel` in interface `JetlangSession`

#### getSessionRequestChannel

    public org.jetlang.channels.Subscriber<SessionRequest> getSessionRequestChannel()

Specified by:
  `getSessionRequestChannel` in interface `JetlangSession`

#### onRequest

    public void onRequest(int reqId,
                          String reqmsgTopic,
                          Object reqmsg)

#### onClose

    public void onClose(SessionCloseEvent sessionCloseEvent)

#### onReadTimeout

    public void onReadTimeout(ReadTimeoutEvent readTimeoutEvent)