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

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

GitHub user lburgazzoli opened a pull request:

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

    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-pr

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

    https://github.com/apache/camel/pull/2353.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 #2353
    
----
commit c927df33aca97744ede41b76e726d4ecef8d3563
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-29T15:08:00Z

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

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

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

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

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

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

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

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

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

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

    fix consul kv test

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    service registry doc

commit c09d5fc8ce116fe11d0726cd1839688d9eaf3103
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-29T14:48:19Z

    service registry

commit 67a86f57424b976053d86f316b64d44e27437b51
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-29T15:14:24Z

    fix typos

commit 2a7e54e9fea7d8e00d8e104a3b14d3756e33a6dc
Author: lburgazzoli <lburgazzoli@...>
Date:   2018-05-29T16:01:31Z

    regen

----


> 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