Attribute element

IBMStreams com.ibm.streamsx.messaging Toolkit > com.ibm.streamsx.messaging 5.4.3 > Connection specifications document > Access_specification element > Native_schema element > Attribute element

The <attribute> element specifies information about the attributes that are present in an output XMS or JMS message, or are expected in an input XMS or JMS message.

The <attribute> element has three possible attributes:
  • name
    • This mandatory attribute specifies the name by which the attribute is known in the message. The Messaging Toolkit operators use these identifiers exactly as specified to access data in the message. For example, the operators do not change the case of the identifiers.
  • length
    • The length attribute specifies the maximum length of the attribute. The length attribute is required only for String and Bytes data types. If the length attribute is specified for other data types, the JMSSink and JMSSource operators generate a run time error, and the XMSSink and XMSSource operators generate a compile-time error. For the length attribute, the operator handles data based on the message class and the data type:
      • JMSSource
        • If the message class is bytes and String data in the message is smaller than the length specified in the native schema, the message is discarded.
        • For map and stream message classes, the length attribute has no significance.
        • The Blob data type is not supported.
      • JMSSink
        • If the message class is bytes and String data in the tuple is smaller than the length specified in the native schema, the String data is padded with spaces to fit the length. For other message classes, the String data is written as is.
        • If the String data in the tuple is longer than the length specified in the native schema and the message class is either map, stream, bytes, xml, wbe, or wbe22, the String data is truncated.
        • If the message class is bytes and Bytes data in the tuple is smaller than the length specified in the native schema, the Bytes data is padded with null values to fit the length. For other message classes, the Bytes data is written as is.
        • If the Blob data in the tuple is longer than the length specified in the native schema and the message class is either map, stream, bytes, or xml, the Blob data is truncated. For message classes wbe and wbe22, Blob data type is not supported.
      • XMSSource
        • If the message class is bytes and the String or Bytes data in the message is smaller than the length specified in the native schema, the message is discarded.
        • If the message class is map or stream, the length attribute is ignored for String data.
        • If the message class is map or stream and the Bytes data in the message is smaller than the length specified in the native schema, the Bytes data is padded with null values to fit the length.
        • If the message class is map or stream and the Bytes data is in the message is longer than the length specified in the native schema, the Bytes data is truncated to fit the length.
      • XMSSink
        • If the message class is bytes and the String data in the tuple is smaller than the length specified in the native schema, the String data is padded with spaces to fit the length. For other message classes the String data is written as is.
        • If the String data in the tuple is longer than the length specified in the native schema and the message class is either map, stream, bytes, or xml, the String data is truncated.
        • If the message class is bytes and the Bytes data in the tuple is smaller than the length specified in the native schema, the Bytes data is padded with null values to fit the length. For other message classes the Bytes data is written as is.
        • If the Blob data in the tuple is longer than the length specified in the native schema and the message class is either map, stream, bytes, or xml, the Blob data is truncated. For message classes wbe and wbe22, Blob data is not supported.
  • type
    • This mandatory attribute specifies the data type of the attribute. The following XMS data types and corresponding SPL types, which are listed in brackets, can be used in the access specifications for the XMSSink and XMSSource operators:
      • Byte (int8)
      • Short(uint8, int16)
      • Int (uint16, int32)
      • Long (uint32, int64)
      • Float (float32)
      • Double (float64)
      • Boolean (boolean)
      • Bytes (blob) Note: The SPL type blob is not supported for message classes wbe and wbe22 by the XMSSink operator.
      • String (rstring)
    • The following table lists the data types that can be used in the access specifications for the JMSSink and JMSSource operators. It also lists the corresponding SPL types for each JMS type.
        SPL type   JMS type based on message class
                   map      stream   bytes    xml     wbe            wbe22
        ===================================================================
        int8       Byte     Byte     Byte     String  String         String
        uint8      Byte     Byte     Byte     String  String         String
        int16      Short    Short    Short    String  String         String
        uint16     Short    Short    Short    String  String         String
        int32      Int      Int      Int      String  String         String
        uint32     Int      Int      Int      String  String         String
        int64      Long     Long     Long     String  String         String
        uint64     Long     Long     Long     String  String         String
        float32    Float    Float    Float    String  String         String
        float64    Double   Double   Double   String  String         String
        boolean    Boolean  Boolean  Boolean  String  String         String
        blob*      Bytes    Bytes    Bytes    String  Not supported  Not supported
        rstring*   String   String   Bytes    String  String         String
        decimal32  String   String   Bytes    String  String         String
        decimal64  String   String   Bytes    String  String         String
        decimal128 String   String   Bytes    String  String         String
        timestamp* String   String   Bytes    String  String         String
        ustring    String   String   Bytes    String  String         String
      
      • NOTE:
        • The blob SPL type is not supported for message classes wbe and wbe22 by the JMSSink operator. The Blob data type is not supported by JMSSource operator.
        • The information for the rstring SPL type assumes that you use UTF-8 encoding.
        • The information for the timestamp SPL type assumes that you use the 1970 UNIX epoch.
      • The following SPL data types are not supported by the Messaging Toolkit operators:
        • enum
        • complexb
        • composite types
        • xml