Github user rban1 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2026#discussion_r109327926
  
    --- Diff: 
external/storm-eventhubs/src/main/java/org/apache/storm/eventhubs/spout/EventDataScheme.java
 ---
    @@ -44,27 +41,31 @@
     public class EventDataScheme implements IEventDataScheme {
     
        private static final long serialVersionUID = 1L;
    -
    +   private static final Logger logger = 
LoggerFactory.getLogger(EventDataScheme.class);
        @Override
    -   public List<Object> deserialize(Message message) {
    +   public List<Object> deserialize(EventData eventData) {
                final List<Object> fieldContents = new ArrayList<Object>();
    -
    -           Map metaDataMap = new HashMap();
                String messageData = "";
    -
    -           for (Section section : message.getPayload()) {
    -                   if (section instanceof Data) {
    -                           Data data = (Data) section;
    -                           messageData = new 
String(data.getValue().getArray());
    -                   } else if (section instanceof AmqpValue) {
    -                           AmqpValue amqpValue = (AmqpValue) section;
    -                           messageData = amqpValue.getValue().toString();
    -                   } else if (section instanceof ApplicationProperties) {
    -                           final ApplicationProperties 
applicationProperties = (ApplicationProperties) section;
    -                           metaDataMap = applicationProperties.getValue();
    +           if (eventData.getBytes()!=null) {
    +                   messageData = new String(eventData.getBytes());
    +           }
    +           /*Will only serialize AMQPValue type*/
    +           else if (eventData.getObject()!=null) {
    +                   try {
    +                           if (!(eventData.getObject() instanceof List)) {
    +                                   messageData = 
eventData.getObject().toString();
    +                           } else {
    +                                   throw new RuntimeException("Cannot 
serialize the given AMQP type");
    +                           }
    +                   } catch (RuntimeException e) {
    +                           logger.error("Failed to serialize EventData 
payload class"
    +                                           + 
eventData.getObject().getClass());
    +                           logger.error("Exception encountered while 
serializing EventData payload is"
    +                                           + e.toString());
    +                           throw e;
                        }
                }
    -
    +           Map metaDataMap = eventData.getProperties().size() > 0 ? 
eventData.getProperties() : null;
                fieldContents.add(messageData);
                fieldContents.add(metaDataMap);
    --- End diff --
    
    will remove them


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to