Returning information from the getStatus method
The adapter's transport and codec getStatus methods periodically update status information. The transport and codec send this information to the IAFStatusManager.
To take advantage of the IAFStatusManager for an adapter written in Java, the adapter author should implement the
getStatus method so that it returns an
ExtendedTransportStatus or
ExtendedCodecStatus object. These objects include a
Properties parameter,
statusInfo, which contains custom information about the adapter. See the
API Reference for Java (Javadoc) for detailed information on the
ExtendedTransportStatus and
ExtendedCodecStatus classes.
For adapters written in C or C++, the adapter author should implement the
getStatus function to include the
statusDictionary in an
AP_EventTransportStatus or
AP_EventCodecStatus structure. See the
API Reference for C++ (Doxygen) for detailed information on the
AP_EventTransportStatus and
AP_EventCodecStatus structures.
The IAFStatusManager then forwards the information to registered consumers of that transport or codec's status information in the form of a dictionary added to the AdapterUp event.
Example
In the following example, the custom status information for VERSION and CONNECTION is included in the information returned by the getStatus method:
public static final String TRANSPORT_VERSION="1";
protected long connGeneration;
...
public TransportStatus getStatus()
{
Properties properties=new Properties();
properties.setProperty("VERSION", TRANSPORT_VERSION);
if(market!=null)
{
properties.setProperty("CONNECTION",
String.valueOf(connGeneration));
}
return new ExtendedTransportStatus("OK", numReceived, numSent,
properties);
}
For more information on specifying the
CONNECTION property, see
Asynchronously notifying IAFStatusManager of connection
changes.