You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Emmerson (Jira)" <ji...@apache.org> on 2020/04/22 11:11:00 UTC

[jira] [Comment Edited] (CAMEL-14944) Rest routes can not be suspended using controlbus

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

Emmerson edited comment on CAMEL-14944 at 4/22/20, 11:10 AM:
-------------------------------------------------------------

Many thanks, is working (y)!!!

 

The only problem I found I think is about how to use REST DSL API, because after set the routeId I wasn't able to declare another resource, so I come up with following declaration which is working fine.

 

 
{code:java}
rest("/mngt").id("mngt-endpoint").description("RabbitMQ Camel Management service")
 .consumes("application/json").produces("application/json") 
 .get("/stats")
 .description("Stats Apache Camel").route().routeId("mngt-endpoint-stats")
 .to(StatsRouteBuilder.DIRECT_STATS)
 ;
rest("/mngt").id("mngt-endpoint").description("RabbitMQ Camel Management service")
 .consumes("application/json").produces("application/json")
 .get("/shutdown")
 .description("Shutdown Apache Camel").route().routeId("mngt-endpoint-shutdown")
 .to(ShutdownRouteBuilder.DIRECT_SHUTDOWN_MESSAGE_CONSUMERS_ENDPOINT)
 ;
{code}
 

 


was (Author: emmerson):
Many thanks, is working (y)!!!

 

The only problem I found i think is about how to use REST DSL API, because after set the routeId I wasnt able to declare another resourece, so I come up with following declararion which is working fine.

 

 
{code:java}
rest("/mngt").id("mngt-endpoint").description("RabbitMQ Camel Management service")
 .consumes("application/json").produces("application/json") 
 .get("/stats")
 .description("Stats Apache Camel").route().routeId("mngt-endpoint-stats")
 .to(StatsRouteBuilder.DIRECT_STATS)
 ;
rest("/mngt").id("mngt-endpoint").description("RabbitMQ Camel Management service")
 .consumes("application/json").produces("application/json")
 .get("/shutdown")
 .description("Shutdown Apache Camel").route().routeId("mngt-endpoint-shutdown")
 .to(ShutdownRouteBuilder.DIRECT_SHUTDOWN_MESSAGE_CONSUMERS_ENDPOINT)
 ;
{code}
 

 

> Rest routes can not be suspended using controlbus
> -------------------------------------------------
>
>                 Key: CAMEL-14944
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14944
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-restlet, camel-undertow
>    Affects Versions: 3.1.0, 3.2.0
>         Environment: java version "1.8.0_181"
> Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
> Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
>            Reporter: Emmerson
>            Priority: Major
>
> Hello,
> I am defining a REST route with route identifier "mngt-endpoint-stats"
> {code:java}
> restConfiguration().component("undertow")
> .bindingMode(RestBindingMode.json)
> .contextPath("/").host("0.0.0.0").port(9090)
> .apiContextPath("/api-doc")
> .apiContextRouteId("api-doc-endpoint")
> .apiProperty("api.title", "Producer API")
> .apiProperty("api.version", "1.0.0")
> .apiProperty("cors", "true");
> rest("/mngt").id("mngt-endpoint")
>  .consumes("application/json").produces("application/json")
>  .get("/stats").id("mngt-endpoint-stats").description("Stats Apache Camel")
>  .to(StatsRouteBuilder.DIRECT_STATS){code}
>  
> I want to suspend/resume the route dynamically due schedule maintenance periods or return 503 along that time.
>  
> I am trying to use the controlbus to suspend the route but after call it the endpoint is still available and working.
>  
> {code:java}
> .toD("controlbus:route?routeId=${exchangeProperty.routesIds[${exchangeProperty.CamelLoopIndex}]}&action=suspend");{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)