OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
org.omg.dds.sub.SubscriberListener Interface Reference

Since a org.omg.dds.sub.Subscriber is a kind of org.omg.dds.core.Entity, it has the ability to have an associated listener. More...

Inheritance diagram for org.omg.dds.sub.SubscriberListener:
Inheritance graph
Collaboration diagram for org.omg.dds.sub.SubscriberListener:
Collaboration graph

Public Member Functions

void onDataAvailable (DataAvailableEvent<?> status)
 This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when new data is available for this DataReader. More...
 
void onDataOnReaders (DataOnReadersEvent status)
 This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when new data is available for this Subscriber. More...
 
void onLivelinessChanged (LivelinessChangedEvent<?> status)
 This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the liveliness of one or more DataWriter objects that were writing instances read through this DataReader has changed. More...
 
void onRequestedDeadlineMissed (RequestedDeadlineMissedEvent<?> status)
 This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the deadline that the DataReader was expecting through its DeadlineQosPolicy was not respected for a specific instance. More...
 
void onRequestedIncompatibleQos (RequestedIncompatibleQosEvent<?> status)
 This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the RequestedIncompatibleQosStatus changes. More...
 
void onSampleLost (SampleLostEvent<?> status)
 This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when a sample is lost and this is detected. More...
 
void onSampleRejected (SampleRejectedEvent<?> status)
 This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when a (received) sample has been rejected. More...
 
void onSubscriptionMatched (SubscriptionMatchedEvent<?> status)
 This operation is called by the Data Distribution Service when a new match has been discovered for the current subscription, or when an existing match has ceased to exist. More...
 

Detailed Description

Since a org.omg.dds.sub.Subscriber is a kind of org.omg.dds.core.Entity, it has the ability to have an associated listener.

In this case, the associated listener must be of concrete type SubscriberListener.

A convenience class org.omg.dds.sub.SubscriberAdapter is offered in Java 5 which has an empty implementation of all listener callback functions when the application extends from this class only the used callback functions that the user wants to use need to be implemented.

Example


public class MySubscriberListener extends SubscriberAdapter
{
     public void onDataAvailable(DataAvailableEvent<?> status) {
         // Handle the incoming data here.
     }
     public void onRequestedIncompatibleQos(RequestedIncompatibleQosEvent<?> status) {
         // Handle the incompatibility here.
     }
}
//Instantiate a SubscriberListener.
MySubscriberListener listener = new MySubscriberListener();
// Instantiate and add the status masks.
Collection<Class<? extends Status>> statuses = new HashSet<Class<? extends Status>>();
statuses.add(DataAvailableStatus.class);
statuses.add(RequestedIncompatibleQosStatus.class);
// Create the Subscriber with the listener and the bit-mask.
participant.createSubscriber( participant.getDefaultSubscriberQos(), listener, statuses);

Definition at line 66 of file SubscriberListener.java.

Member Function Documentation

◆ onDataAvailable()

void org.omg.dds.sub.SubscriberListener.onDataAvailable ( DataAvailableEvent<?>  status)

This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when new data is available for this DataReader.

The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant SubscriberListener is installed and enabled for the DataAvailableStatus.

The statuses DataOnReadersStatus and DataAvailableStatus will occur together. In case these status changes occur, the Data Distribution Service will look for an attached and activated SubscriberListener or DomainParticipantListener (in that order) for the DataOnReadersStatus. In case the DataOnReadersStatus can not be handled, the Data Distribution Service will look for an attached and activated DataReaderListener, SubscriberListener or DomainParticipantListener for the DataAvailableStatus (in that order).

Note that if onDataOnReaders is called, then the Data Distribution Service will not try to call onDataAvailable, however, the application can force a call to the DataReader objects that have data by means of the notifyDatareaders operation.

Parameters
statusContains the DataAvailableStatus object (this is an input to the application).

Implemented in org.omg.dds.domain.DomainParticipantAdapter, and org.omg.dds.sub.SubscriberAdapter.

◆ onDataOnReaders()

void org.omg.dds.sub.SubscriberListener.onDataOnReaders ( DataOnReadersEvent  status)

This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when new data is available for this Subscriber.

The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant SubscriberListener is installed and enabled for the DataOnReadersStatus.

The statuses DataOnReadersStatus and DataAvailableStatus will occur together. In case these status changes occur, the Data Distribution Service will look for an attached and activated SubscriberListener or DomainParticipantListener (in that order) for the DataOnReadersStatus. In case the DataOnReadersStatus can not be handled, the Data Distribution Service will look for an attached and activated DataReaderListener, SubscriberListener or DomainParticipantListener for the DataAvailableStatus (in that order).

Note that if onDataOnReaders is called, then the Data Distribution Service will not try to call onDataAvailable, however, the application can force a call to the DataReader objects that have data by means of the notifyDatareaders operation.

Parameters
statusContains the DataOnReadersStatus object (this is an input to the application).

Implemented in org.omg.dds.sub.SubscriberAdapter, and org.omg.dds.domain.DomainParticipantAdapter.

◆ onLivelinessChanged()

void org.omg.dds.sub.SubscriberListener.onLivelinessChanged ( LivelinessChangedEvent<?>  status)

This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the liveliness of one or more DataWriter objects that were writing instances read through this DataReader has changed.

In other words, some DataWriter have become "alive" or "not alive". The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant SubscriberListener is installed and enabled for the LivelinessChangedStatus.

The Data Distribution Service will provide a reference to the LivelinessChangedStatus object for use by the application.

Parameters
statusContains the LivelinessChangedStatus object (this is an input to the application).

Implemented in org.omg.dds.domain.DomainParticipantAdapter, and org.omg.dds.sub.SubscriberAdapter.

◆ onRequestedDeadlineMissed()

void org.omg.dds.sub.SubscriberListener.onRequestedDeadlineMissed ( RequestedDeadlineMissedEvent<?>  status)

This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the deadline that the DataReader was expecting through its DeadlineQosPolicy was not respected for a specific instance.

The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant SubscriberListener is installed and enabled for the RequestedDeadlineMissedStatus.

The Data Distribution Service will provide a reference to the RequestedDeadlineMissedStatus object in the parameter status for use by the application.

Parameters
statusContains the RequestedDeadlineMissedStatus object (this is an input to the application).

Implemented in org.omg.dds.domain.DomainParticipantAdapter, and org.omg.dds.sub.SubscriberAdapter.

◆ onRequestedIncompatibleQos()

void org.omg.dds.sub.SubscriberListener.onRequestedIncompatibleQos ( RequestedIncompatibleQosEvent<?>  status)

This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when the RequestedIncompatibleQosStatus changes.

The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant SubscriberListener is installed and enabled for the RequestedIncompatibleQosStatus.

The Data Distribution Service will provide a reference to the RequestedIncompatibleQosStatus object in the parameter status, for use by the application.

The application can use this operation as a callback function implementing a proper response to the status change. This operation is enabled by setting the RequestedIncompatibleQosStatus in the listener status mask

Parameters
statusContains the RequestedIncompatibleQosStatus object (this is an input to the application).

Implemented in org.omg.dds.domain.DomainParticipantAdapter, and org.omg.dds.sub.SubscriberAdapter.

◆ onSampleLost()

void org.omg.dds.sub.SubscriberListener.onSampleLost ( SampleLostEvent<?>  status)

This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when a sample is lost and this is detected.

The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant SubscriberListener is installed and enabled for the SampleLostStatus.

The Data Distribution Service will provide a reference to the SampleLostStatus object for use by the application.

Parameters
statusContains the SampleLostStatus object (this is an input to the application).

Implemented in org.omg.dds.domain.DomainParticipantAdapter, and org.omg.dds.sub.SubscriberAdapter.

◆ onSampleRejected()

void org.omg.dds.sub.SubscriberListener.onSampleRejected ( SampleRejectedEvent<?>  status)

This operation is the external operation (interface, which must be implemented by the application) that is called by the Data Distribution Service when a (received) sample has been rejected.

Samples may be rejected by the DataReader when it runs out of resource_limits to store incoming samples. Usually this means that old samples need to be 'consumed' (for example by 'taking' them instead of 'reading' them) to make room for newly incoming samples.

The implementation may be left empty when this functionality is not needed. This operation will only be called when the relevant SubscriberListener is installed and enabled for the SampleRejectedStatus.

The Data Distribution Service will provide a reference to the SampleRejectedStatus object in the parameter status for use by the application.

Parameters
statusContains the SampleRejectedStatus object (this is an input to the application).

Implemented in org.omg.dds.domain.DomainParticipantAdapter, and org.omg.dds.sub.SubscriberAdapter.

◆ onSubscriptionMatched()

void org.omg.dds.sub.SubscriberListener.onSubscriptionMatched ( SubscriptionMatchedEvent<?>  status)

This operation is called by the Data Distribution Service when a new match has been discovered for the current subscription, or when an existing match has ceased to exist.

Usually this means that a new DataWriter that matches the Topic and that has compatible Qos as the current DataReader has either been discovered, or that a previously discovered DataWriter has ceased to be matched to the current DataReader. A DataWriter may cease to match when it gets deleted, when it changes its Qos to a value that is incompatible with the current DataReader or when either the DataReader or the DataWriter has chosen to put its matching counterpart on its ignore-list using the ignoreSubscription or ignorePublication operations.

The implementation of this Listener operation may be left empty when this functionality is not needed: it will only be called when the relevant SubscriberListener is installed and enabled for the SubscriptionMatchedStatus

Parameters
statusContains the SubscriptionMatchedStatus object (this is an input to the application).

Implemented in org.omg.dds.domain.DomainParticipantAdapter, and org.omg.dds.sub.SubscriberAdapter.


The documentation for this interface was generated from the following file: