Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-13988

Enable camel-protobuf to marshal from objects of type Map to Proto using the message descriptor

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.0.RC1
    • 3.0.0.RC2, 3.0.0
    • None
    • None
    • Unknown

    Description

      Currently, when you marshal using camel-protobuf, it expects beforehand that you have already created your protobuf message as you can see here. I think is beneficial if the user can marshal the data automatically to protobuf provided he/she has the data in Map type and with the correct instance class name is provided. We can achieve this with the following steps:

      1. In marshal method, we check if the graph object of type Map.class.
      2. If it is of type Map.class, then using the defaultInstance.getDescriptorForType(), we obtain the Message Descriptor for the class instance.
      3. Using the obtained descriptor, we iterate over map value and set the field from the descriptor.

      By using this, the user can marshal data to Protobuf without the need to process it before as long he/she has the data in type Map. I can send a PoC PR if you guys find my proposal reasonable enough but from my the top of my head, it shouldn't be much of work to add this feature to camel-protobuf

      Attachments

        Issue Links

          Activity

            People

              omarsmak Omar Al-Safi
              omarsmak Omar Al-Safi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m