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

Raymond commented on CAMEL-22378:
---------------------------------

Yes, I understand your argument. As a framework, you want to offer data at the 
lowest level. Users of the framework can then combine it according to their own 
use case. Offering data at a higher level can always lead to dissatisfaction. 
Some will find it too little data, others too much.

The reason for this request was mainly based on the idea of convention over 
configuration, i.e., a dataset that is sufficient for most people and can be 
easily offered via a high-level API. Imo the RouteController API is 
insufficient to provide data on the lifecycle actions.

If you want to be really strict, you would need to have a separate interface to 
get to installation details (maybe a bit higher level then the current API's). 
Alternatively, offer a separate library that use the core library, and then 
offers an interface for JSON/XML/YAML data on top of that. Runtimes can then 
decide to use this library or implement their own (all "dump" methods and other 
methods that need serialization can then moved to this library).

> camel-core - Route installation status report
> ---------------------------------------------
>
>                 Key: CAMEL-22378
>                 URL: https://issues.apache.org/jira/browse/CAMEL-22378
>             Project: Camel
>          Issue Type: Wish
>          Components: came-core
>    Affects Versions: 4.14.0
>            Reporter: Raymond
>            Priority: Major
>             Fix For: 4.x
>
>
> This ticket is basically a wish/idea to better information after installation 
> of routes or a route group.
> The routeController actions, such as start/stop/suspend/resume currently are 
> void and don't return the status/result of the action. Sometimes however one 
> would like to have more information. 
> There is the 
> {{[hasUnhealthyRoutes|https://www.javadoc.io/static/org.apache.camel/camel-api/4.14.0/org/apache/camel/spi/RouteController.html#hasUnhealthyRoutes()]()}}
>  method and {{getRouteStatus(routeId). But hasUnhealthyRoutes only return a 
> boolean, while the getRouteStatus }}returns a {{ServiceStatus}} enum 
> ({{{}Started{}}}, {{{}Starting{}}}, {{{}Stopped{}}}, {{{}Failed{}}}, etc.).
> Of course there are indirect ways to get more information such as 
> EventNotifier or RoutePolicy, but I think the routeController could provide 
> an easier access to such information.
> I would like to have a report with information like:
> 1. Route ID
> 2. Group
> 3. From uri
> 4. Time (Either a unix timestamp or an ISO 8601 date)
> 5. ServiceStatus
> 6. Unhealhy (true/false)
> 7. Error message
> A method such as "getInstallationReport("routeId")" could return:
> {
>     "routeId": "123",
>     "group": "order",
>     "time": "2025-08-27T09:04:32.456",
>     "fromUri": "sql:somesql",
>     "unhealthy": true,
>     "status": "failed",
>     "error": "Database error"
> }
> For a group or all routes it can be put in a JSONArray. For example 
> getInstallationReportByGroup("myGroup")
> [{
>     "routeId": "123",
>     "group": "order",
>     "time": "2025-08-27T09:04:32.456",
>     "fromUri": "sql:somesql",
>     "unhealthy": true,
>     "status": "failed",
>     "error": "Database error"
> },
> {
>     "routeId": "456",
>     "group": "order",
>     "time": "2025-08-27T09:04:34.362",
>     "fromUri": "direct:validate",
>     "unhealthy": false,
>     "status": "started",
>     "error": ""
> }]
> This can be either per route or route group. To give an idea, here is an 
> example installation report that is returned by Assimbly (a flow in this case 
> is group, while step a route):
> {code:java}
> {"flow": {
>     "stepsLoaded": {
>         "total": 5,
>         "successfully": 5,
>         "failed": 0
>     },
>     "name": "686e726ecd40200007000004",
>     "id": "686e726ecd40200007000004",
>     "time": "1535 milliseconds",
>     "event": "start",
>     "message": "Started flow successfully",
>     "version": "",
>     "steps": [
>         {
>             "id": "0",
>             "type": "error",
>             "uri": "",
>             "status": "success"
>         },
>         {
>             "id": "94bd94b8efa7",
>             "type": "routeTemplate",
>             "uri": "texttobase64",
>             "status": "success"
>         },
>         {
>             "id": "886fd5a7817d",
>             "type": "routeTemplate",
>             "uri": "setbody?language=simple&expression=1234",
>             "status": "success"
>         },
>         {
>             "id": "706c927a3480",
>             "type": "routeTemplate",
>             "uri": "log?showBody=true&showException=false&showHeaders=false",
>             "status": "success"
>         },
>         {
>             "id": "22fe3e66c3cc",
>             "type": "routeTemplate",
>             "uri": "https://0.0.0.0:9001/test/inbound_http/_new/textToBase64";,
>             "status": "success"
>         }
>     ]
> }} {code}
>  
> I guess such a report would be handy whether you start route or route group 
> through the routecontroller, routeloader or context.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to