AppLibLifecycleListener
should be used instead of
connected(fi.tkk.netlab.dtn.scampi.applib.AppLib)
and error(fi.tkk.netlab.dtn.scampi.applib.AppLib, java.lang.Exception)
. The functional interface
(callbacks) should be used instead of messageReceived(fi.tkk.netlab.dtn.scampi.applib.AppLib, java.lang.String, fi.tkk.netlab.dtn.scampi.applib.SCAMPIMessage)
.@Deprecated
public interface AppLibListener
Modifier and Type | Method and Description |
---|---|
void |
connected(AppLib applib)
Deprecated.
The client has successfully connected to a server.
|
void |
error(AppLib applib,
java.lang.Exception exception)
Deprecated.
AppLib has encountered an exception and terminated.
|
void |
messageReceived(AppLib applib,
java.lang.String service,
SCAMPIMessage message)
Deprecated.
Received a message that was published to the given service.
|
void connected(AppLib applib)
applib
- AppLib instance that is calling the listener.void messageReceived(AppLib applib, java.lang.String service, SCAMPIMessage message)
Received a message that was published to the given service. Will only be
called for messages destined to a service that the client has subscribed
to using AppLib.subscribe()
.
Note that the received SCAMPIMessage
instance shares faith
with the underlying TCP connection. In other words, the message,
including any file pointers contained in it, cannot be trusted to be
valid after the API TCP connection has died due to error, timeout or
the server closing, etc. If the application wishes to guarantee that some
part of the message stays valid it should make a copy of it.
applib
- AppLib instance that is calling the listener.service
- service to which the message is published to.message
- message that was received.void error(AppLib applib, java.lang.Exception exception)
applib
- AppLib instance that is calling the listener.exception
- exception that caused the termination.