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

    https://github.com/apache/storm/pull/2026#discussion_r108012858
  
    --- Diff: 
external/storm-eventhubs/src/main/java/org/apache/storm/eventhubs/spout/EventDataScheme.java
 ---
    @@ -44,27 +43,21 @@
     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());
    +           else if(eventData.getObject()!=null){
    +                   try{
    +                   messageData = new 
String(Serializedeserializeutil.serialize(eventData.getObject()),Charset.defaultCharset());
    +           }catch (IOException e){
    +                   logger.error("Failed to serialize object"+e.toString());
                }
    -
    +           }
    +           Map metaDataMap = eventData.getProperties();
    --- End diff --
    
    >Map metaDataMap = eventData.getProperties(); [](start = 2, length = 44)
    
    the old solution is not optimal - will result into too many unnecessary map 
objects initialized; pls evaluate if you want to change it
    if map.count()==0 (ie., empty map) - dont even return 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