[ 
https://issues.apache.org/jira/browse/CAMEL-11174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15985253#comment-15985253
 ] 

Dmitry Volodin edited comment on CAMEL-11174 at 4/26/17 6:05 PM:
-----------------------------------------------------------------

Hi Luis!

It's a not a good idea to overload core and rest-dsl subsystems with 
non-typical functions, i.e. marshal/unmarshal third-party binary formats, etc. 
As camel supports protobuf format OOB, you could create a very simple route 
like this for implementing described scenario:
{code:xml}
<camelContext id="camelContext-47e82289-6ff4-4210-a7f0-5e93f397b04a" 
xmlns="http://camel.apache.org/schema/spring";>
    <restConfiguration component="restlet" port="8181"/>
    <rest bindingMode="off" id="_rest1" path="/test" 
produces="application/octetstream">
        <get uri="/id">
            <to uri="direct:test-id"/>
        </get>
    </rest>
    <route id="_route1">
        <from id="_from1" uri="direct:test-id"/>
        <bean id="_bean1" method="buildPongResponse" ref="messageBuilder"/>
        <marshal id="_marshal1">
            <protobuf/>
        </marshal>
    </route>
</camelContext>
{code}

P.S. The gRPC or Thrift RPC are working much quickly, however your case is good 
example to be implemented as sample.  


was (Author: dmvolod):
Hi Luis!

It's a not a good idea to overload core and rest-dsl subsystems with 
non-typical functions, i.e. marshal/unmarshal third-party binary formats, etc. 
As camel supports protobuf format OOB, you could create a very simple route 
like this for implementing described scenario:
<camelContext id="camelContext-47e82289-6ff4-4210-a7f0-5e93f397b04a" 
xmlns="http://camel.apache.org/schema/spring";>
    <restConfiguration component="restlet" port="8181"/>
    <rest bindingMode="off" id="_rest1" path="/test" 
produces="application/octetstream">
        <get uri="/id">
            <to uri="direct:test-id"/>
        </get>
    </rest>
    <route id="_route1">
        <from id="_from1" uri="direct:test-id"/>
        <bean id="_bean1" method="buildPongResponse" ref="messageBuilder"/>
        <marshal id="_marshal1">
            <protobuf/>
        </marshal>
    </route>
</camelContext>

P.S. The gRPC or Thrift RPC are working much quickly, however your case is good 
example to be implemented as sample.  

> REST-DSL support for Google Protobuf
> ------------------------------------
>
>                 Key: CAMEL-11174
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11174
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>            Reporter: Luis
>
> It would be nice to be able to output something other that just XML/JSON
> from a camel rest dsl route, namely Google Protobuf or Apache thrift.
> The idea would be that one could have addional MIME types add one could 
> define how they are handled.
> So for example application/x-protobuf could be handle by Protobuf.
> One example article that comes to mind is:
> https://javarants.com/using-jax-rs-with-protocol-buffers-for-high-performance-rest-apis-563ce40d15d9



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to