Getting Sequence Field Values
Several methods are provided for obtaining all of the values from a sequence event field, or a subset of the sequence, with a single method call. These methods are described in BrokerEvent.get<type>SeqField.
You can also use the BrokerEvent.get<type>Field to obtain a single value from a sequence field by specifying the field name with an index.
The following example shows the use of the BrokerEvent.getIntegerSeqField method. This method takes the following parameters:
The name of the event sequence field being accessed.
The number of elements to skip from the beginning of the sequence field in the event.
The number of source elements to be retrieved.
int count_array[];
int num_retrieved;
. . .
try {
count_array = e.getIntegerSeqField("count", 0, 5);
} catch (BrokerException ex) {
System.out.println("Error on getting sequence field\n"+ex);
return;
}
. . .
The manner in which the target array is specified depends on the sequence's type.
BrokerEvent Method Name | Field Value Type |
getBooleanSeqField | boolean[] |
getByteSeqField | byte[] |
getCharSeqField | char[] |
getDateSeqField | BrokerDate[] |
getDoubleSeqField | double[] |
getFloatSeqField | float[] |
getIntegerSeqField | int[] |
getLongSeqField | long[] |
getShortSeqField | short[] |
getStringSeqField | String[] |
You can also use the BrokerEvent.getSequenceField method to obtain the contents of a sequence field. The BrokerEvent.getSequenceFieldSize method can be used to obtain the number of elements contained in a sequence field.