Hi Riaan

Thanks for the information, I came up with an option with several
camelCcontexts, then I can have several configs on different ports

<camelContext id="rest" xmlns="http://camel.apache.org/schema/spring";>
    <restConfiguration apiContextPath="/swagger" bindingMode="off"
        component="jetty" contextPath="/fesb-rest"
        enableCORS="false" host="0.0.0.0" port="9090" scheme="http">
        <dataFormatProperty key="prettyPrint" value="true"/>
        <apiProperty key="api.title" value="REST API"/>
        <apiProperty key="api.version" value="1.0"/>
    </restConfiguration>
    <rest id="15bdb735-61c4-4e6f-b765-d2a76c2acb5a" path="/path"
produces="application/json">
        <description>test path</description>
        <get id="0fddca6a-857d-4085-bfc3-eece15b7357c"
            produces="application/json" uri="/get">
            <description>Get method</description>
            <to uri="direct-vm://restLink"/>
        </get>
    </rest>
</camelContext>
<camelContext id="rest2" xmlns="http://camel.apache.org/schema/spring";>
    <restConfiguration apiContextPath="/swagger2" bindingMode="off"
                       component="jetty" contextPath="/fesb-rest2"
                       enableCORS="false" host="0.0.0.0" port="9292"
scheme="http">
        <dataFormatProperty key="prettyPrint" value="true"/>
        <apiProperty key="api.title" value="REST API"/>
        <apiProperty key="api.version" value="1.0"/>
    </restConfiguration>
    <rest id="15bdb735-61c4-4e6f-b765-d2a76c2acb5b" path="/path"
produces="application/json">
        <description>test path</description>
        <get id="0fddca6a-857d-4085-bfc3-eece15b7357d"
             produces="application/json" uri="/get">
            <description>Get method</description>
            <to uri="direct-vm://restLink"/>
        </get>
    </rest>
</camelContext>


пт, 24 янв. 2020 г. в 12:06, Riaan Annandale <[email protected]>:

> Hi Mikhail
>
> For what it's worth, I asked a similar question before. Part of my REST
> config:
>         if (Boolean.parseBoolean(System.getenv("authDisabled"))) {
>             endpointProperty = "myLog";
>         } else endpointProperty = "myLog, sessionHandler";
>
>         restConfiguration()
>                 .component("jetty")
>                 .endpointProperty("handlers", endpointProperty)
>
> sessionHandler is an object that contains my integration into Keycloak for
> OAUTH2 things
>
> My use case was that I'd like to run a 2nd rest config on a different port
> (which will be unsecured) so that I can put a 2nd instance of my rest
> endpoints behind an API gateway. Unfortunately I received no response, so
> my solution was to run two instances of my camel code. I am fortunate
> enough to be able to do that because I don't keep state inside camel but
> rather in things like mongodb/ postgresql.
>
> Unless someone pipes up to let us know how to run multiple rest configs, I
> suggest looking at a solution like mine
>
> Riaan
>
> -----Original Message-----
> From: Mikhail Lukyanov <[email protected]>
> Sent: Friday, 24 January 2020 09:52
> To: [email protected]
> Subject: Is it possible to have several rest configurations in rest dsl,
> for example with http and https schemes on different ports?
>
> I hava one rest config for http scheme, but I need several configurations,
> for example, for https scheme to on different port. I use 2.20.2
> camel-version. My config
>
> *-<camelContext xmlns="http://camel.apache.org/schema/spring
> <http://camel.apache.org/schema/spring>" id="rest">*
> *   -<restConfiguration scheme="http" producerComponent="http" port="9090"
> host="0.0.0.0" contextPath="/fesb-rest" component="jetty"
> bindingMode="off">*
> *   <dataFormatProperty value="true" key="prettyPrint"/>*
> *</restConfiguration>*
> *   -<rest id="4f777f7b-f2fd-4107-8271-a50640d4525c"
> produces="application/json" path="/path">*
> *   -<get id="026ea872-e2f8-4772-8d10-6482b8549f11"
> produces="application/json" uri="/get">*
> *   <description/>*
> *   <to uri="direct-vm://restLink"/>*
> *</get>*
> *</rest>*
>


-- 
*С наилучшими пожеланиями, Лукьянов Михаил*
*Моб: **+7-909-69-71-547​*

Reply via email to