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

ASF GitHub Bot commented on CAMEL-10793:
----------------------------------------

GitHub user lburgazzoli opened a pull request:

    https://github.com/apache/camel/pull/2352

    camel service registry

    This PR is the initial work to ease the process to expose routes as 
services [CAMEL-10793](https://issues.apache.org/jira/browse/CAMEL-10793).
    
    A simple example is:
    
    ```java
    from("service:my-service:undertow:http://0.0.0.0:8080/the/context/path";)
        .log("Route ${routeId} has been invoked");
    ```
    
    As undertow component, supports service registration, this endpoint will be 
registered to a given Service Registry (we now have a binding for consul, 
zookeeper and spring-cloud) as `my-service` along with some metadata such as 
the protocol and the context path. This allow to invoke the service on another 
jvm instance by name, like:
    
    ```java
    from("direct:call")
        .serviceCall("my-service")
    ```
    
    **NOTE**: The implementation is not yet complete so you still need to do 
some manual configuration and the number of supported component that support 
service registration is limited to those extending `camel-http-common` and 
`undertow`  .
    **NOTE**: integration with spring-cloud is not as easy as it should be so I 
had to introduce two new modules: camel-spring-cloud-zookeeper and 
camel-spring-cloud-consul.
    
    Any feedback would be really appreciated.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/lburgazzoli/apache-camel CAMEL-12485

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/camel/pull/2352.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2352
    
----
commit 8959683c39d8d8ff368c91fd2362dc149149cbd3
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-07T17:00:52Z

    CAMEL-12485: camel cloud : create camel-service component

commit cbdb3b64c1c79886d17337517f498fb7804f5fed
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-10T16:33:38Z

    CAMEL-12502: camel cloud : create a service route policy

commit 07594d2fa19d8987eca783a2a7afab70846094b0
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-10T20:31:49Z

    CAMEL-12485: camel cloud : create camel-service component

commit 54b1405759298991a116502a6e60d203f3e91965
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-11T10:33:33Z

    CAMEL-12505: service-call : include ServiceDefinition metatdata when 
computing the final URI

commit 4468cc1e54f0fc2314d34b0172d06c5548de4bc4
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-14T12:49:37Z

    CAMEL-12485: camel cloud : create camel-service component

commit bb9e10539ff0cdcc26539981534bdf39205b760e
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-15T13:06:54Z

    fix consul kv test

commit e62ffebe643eef2897cd393a37a1a7aa4248ca94
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-17T15:02:40Z

    CAMEL-12518: camel cloud : leverage spring-cloud ServiceRegistry to 
register routes

commit e10065dcf25a0ae61a2eeeaa2c20157c577945f3
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-23T10:57:51Z

    CAMEL-12502: camel cloud : create a service route policy

commit 5079e5335a8ee0a92fa70c4f1ff29006c2d51165
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-23T14:35:40Z

    CAMEL-12531: camel cloud : create a spring cloud based camel-service example

commit 51ed886d139a11e9d83e57d8d3806fdbccd92f5f
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-23T18:23:40Z

    CAMEL-12518: camel cloud : leverage spring-cloud ServiceRegistry to 
register routes

commit a887bbe8b07871e2f7713e6a89f2febcf4707f33
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-23T18:25:12Z

    CAMEL-12531: camel cloud : create a spring cloud based camel-service example

commit ad6e928bd388eeee070020793f9c6bc72c04758a
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-24T13:16:08Z

    CAMEL-12518: camel cloud : leverage spring-cloud ServiceRegistry to 
register routes

commit 2611407c6f996a010aa5ca240c21652b45502c82
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-28T11:38:55Z

    CAMEL-12502: camel cloud : create a service route policy

commit aaceeea8250b928fb870408cc7c3aab13e9d7a08
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-28T13:00:08Z

    CAMEL-12502: camel cloud : create a service route policy

commit 1b655e17a7d01f8083b5cd2d76b837d279ded4bb
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-28T13:03:57Z

    CAMEL-12502: camel cloud : create a service route policy

commit fee9b5c3b95c741526e0c768270ce0f9a0695679
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-28T14:08:27Z

    service registry doc

----


> camel cloud: expose routes as a service
> ---------------------------------------
>
>                 Key: CAMEL-10793
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10793
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>            Reporter: Luca Burgazzoli
>            Assignee: Luca Burgazzoli
>            Priority: Minor
>              Labels: cloud
>             Fix For: 2.22.0
>
>
> As today we have a ServiceCall EIP that makes it easy to call external 
> services in a cloud environment leveraging external service registry such as 
> kubernetes, consul, etcd, spring-cloud & co so It could make sense to add a 
> way for a route to register itself in such registries and be available as a 
> service for other to consume.
> Something like:
> {code:java}
>     // programmatic config
>     from("jetty:http://0.0.0.0:8001/service1";)
>         .serviceRegistry()
>             .name("service-1")
>             .host("....")
>             .port(8001)
>             .meta("camel.protocol", "http")
>             .meta("camel.component", "jetty")
>             .meta("camel.context.path", "/service1")
>             .end()
>         .to("direct:service-1")
>     // Inherit from a global config and eventually override it
>     from("jetty:http://0.0.0.0:8002/service2";)
>       .serviceRegistry("service-2")
>           .configRef("service-registry-conf")
>           .port(8002)
>       .to("direct:service-2")
>     // Smart auto configuration
>     //   i.e. if the endpoint implements DiscoverableService
>     from("jetty:http://0.0.0.0:8003/service3";)
>       .serviceRegistry("service-3")
>       .to("direct:service-3")
> {code}
> Beside making camel play better in cloud environment,  you can use the 
> service call to connect camel based micro services with minimal configuration 
> as the registration may provide some additional meta data that the service 
> call can use for auto-configuration (of course not all the registries can do 
> it).
> The future Health  API/Service may then also be configured to remove or 
> invalidate the service if the route is reported as not healthy.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to