Service Exception

The ServiceException class allows the API to send specific service exceptions back to the client. It is used in the Publisher and Service classes:

The ServiceException is thrown by the API in the following circumstances:

  • Publishing data when there are no subscribers ( Publisher class)
  • The API is unable to establish a connection with Delta Control ( Service class)
  • A column in a Data Refinery table does not have an equivalent Java type ( Service class)

Exceptions can be pushed back and caught in the client code. For example, the below could have a try catch around the service.* GetCompatibleTypes("eqTrade")*[where "eqTrade" is one of the standard schemas in Kx Refinery] call:

public void Get_compatible_types_for_eqTrade_table() throws Exception, ServiceException {
    Service service = CreateService();
    service.Start(TimeSpan.FromSeconds(20));
    Map<String, Type> map = service.GetgompatibleTypes("eqTrade");
    System.out.println("ColumnName Type");
    for( Map.Entry<String, Type> entry : map.entrySet()) {
    System.out.printf(ā€œ%s %s%nā€, entry.getKey(), entry.getValue().getTypeName());
    }   
}