org.apache.storm.rocketmq.common.mapper

## Class FieldNameBasedTupleToMessageMapper

- java.lang.Object
- - org.apache.storm.rocketmq.common.mapper.FieldNameBasedTupleToMessageMapper

- All Implemented Interfaces:
    Serializable, TupleToMessageMapper

      public class FieldNameBasedTupleToMessageMapper
      extends Object
      implements TupleToMessageMapper

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `BOLT_KEY`
    `static String` | `BOLT_MESSAGE`
    `String` | `boltKeyField`
    `String` | `boltMessageField`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldNameBasedTupleToMessageMapper()`
    `FieldNameBasedTupleToMessageMapper(String boltKeyField, String boltMessageField)` FieldNameBasedTupleToMessageMapper Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getKeyFromTuple(ITuple tuple)`
    `byte[]` | `getValueFromTuple(ITuple tuple)`
    `FieldNameBasedTupleToMessageMapper` | `withMessageBodySerializer(MessageBodySerializer serializer)` using this method can override the default MessageBodySerializer.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### BOLT_KEY

          public static final String BOLT_KEY

      See Also:
        Constant Field Values

    - #### BOLT_MESSAGE

          public static final String BOLT_MESSAGE

      See Also:
        Constant Field Values

    - #### boltKeyField

          public String boltKeyField

    - #### boltMessageField

          public String boltMessageField

  - ### Constructor Detail

    - #### FieldNameBasedTupleToMessageMapper

          public FieldNameBasedTupleToMessageMapper()

    - #### FieldNameBasedTupleToMessageMapper

          public FieldNameBasedTupleToMessageMapper(String boltKeyField,
                                                    String boltMessageField)

      FieldNameBasedTupleToMessageMapper Constructor.

      Parameters:
        `boltKeyField` - tuple field for selecting the key
        `boltMessageField` - tuple field for selecting the value

  - ### Method Detail

    - #### getKeyFromTuple

          public String getKeyFromTuple(ITuple tuple)

      Specified by:
        `getKeyFromTuple` in interface `TupleToMessageMapper`

    - #### getValueFromTuple

          public byte[] getValueFromTuple(ITuple tuple)

      Specified by:
        `getValueFromTuple` in interface `TupleToMessageMapper`

    - #### withMessageBodySerializer

          public FieldNameBasedTupleToMessageMapper withMessageBodySerializer(MessageBodySerializer serializer)

      using this method can override the default MessageBodySerializer.

      Parameters:
        `serializer` - MessageBodySerializer
      Returns:
        this object

Copyright © 2019 The Apache Software Foundation. All rights reserved.