Session

public class Session

A zenoh-net session.

Methods

LogException

protected static void LogException(Throwable e, String message)

close

public void close()

Close the zenoh-net session.

Throws:

declareEval

public Eval declareEval(String resource, QueryHandler handler)

Declare an eval able to provide data matching the provided resource name resource.

Parameters:
Throws:
Returns:

the Eval.

declarePublisher

public Publisher declarePublisher(String resource)

Declare a publication for resource name resource.

Parameters:
  • resource – the resource name to publish.
Throws:
Returns:

the zenoh Publisher.

declareStorage

public Storage declareStorage(String resource, StorageHandler handler)

Declare a storage for all data matching the provided resource name resource.

Parameters:
  • resource – the resource selection to store.
  • handler – a StorageHandler subclass implementing the callback functions that will be called each time a data matching the stored resource name resource is received and each time a query for data matching the stored resource name resource is received. The StorageHandler.handleQuery(String,String,RepliesSender) function MUST call the provided RepliesSender.sendReplies(Resource[]) function with the resulting data. RepliesSender.sendReplies(Resource[]) can be called with an empty array.
Throws:
Returns:

the zenoh Storage.

declareSubscriber

public Subscriber declareSubscriber(String resource, SubMode mode, DataHandler handler)

Declare a subscribtion for all published data matching the provided resource name resource.

Parameters:
  • resource – the resource name to subscribe to.
  • mode – the subscription mode.
  • handler – a DataHandler subclass implementing the callback function that will be called each time a data matching the subscribed resource name resource is received.
Throws:
Returns:

the zenoh-net Subscriber.

info

public Map<Integer, byte[]> info()
Returns:a map of properties containing various informations about the established zenoh-net session.

open

public static Session open(String locator)

Open a zenoh-net session.

Parameters:
  • locator – a string representing the network endpoint to which establish the session. A typical locator looks like this : "tcp/127.0.0.1:7447". If null, open() will scout and try to establish the session automatically.
Throws:
Returns:

a Zenoh object representing the openned zenoh session..

open

public static Session open(String locator, Map<Integer, byte[]> properties)

Open a zenoh-net session.

Parameters:
  • locator – a string representing the network endpoint to which establish the session. A typical locator looks like this : "tcp/127.0.0.1:7447". If null, open() will scout and try to establish the session automatically.
  • properties – a map of properties that will be used to establish and configure the zenoh session. properties will typically contain the "username" and "password" informations needed to establish the zenoh session with a secured infrastructure. It can be set to null.
Throws:
Returns:

a Zenoh object representing the openned zenoh session..

query

public void query(String resource, String predicate, ReplyHandler handler)

Query data matching resource name resource.

Parameters:
  • resource – the resource to query.
  • predicate – a string that will be propagated to the storages and evals that should provide the queried data. It may allow them to filter, transform and/or compute the queried data. .
  • handler – a ReplyHandler subclass implementing the callback function that will be called on reception of the replies of the query.
Throws:

query

public void query(String resource, String predicate, ReplyHandler handler, QueryDest dest_storages, QueryDest dest_evals)

Query data matching resource name resource.

Parameters:
  • resource – the resource to query.
  • predicate – a string that will be propagated to the storages and evals that should provide the queried data. It may allow them to filter, transform and/or compute the queried data. .
  • handler – a ReplyHandler subclass implementing the callback function that will be called on reception of the replies of the query.
  • dest_storages – a QueryDest indicating which matching storages should be destination of the query.
  • dest_evals – a QueryDest indicating which matching evals should be destination of the query.
Throws:

writeData

public void writeData(String resource, java.nio.ByteBuffer payload)

Send data in a write_data message for the resource resource.

Parameters:
  • resource – the resource name of the data to be sent.
  • payload – the data.
Throws:

writeData

public void writeData(String resource, java.nio.ByteBuffer payload, short encoding, short kind)

Send data in a write_data message for the resource resource.

Parameters:
  • resource – the resource name of the data to be sent.
  • payload – the data.
  • encoding – a metadata information associated with the published data that represents the encoding of the published data.
  • kind – a metadata information associated with the published data that represents the kind of publication.
Throws: