camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CAMEL-7875) Easier write access to Camel context registry
Date Mon, 06 Oct 2014 16:33:34 GMT


ASF GitHub Bot commented on CAMEL-7875:

GitHub user yuruki opened a pull request:

    CAMEL-7875 Method for adding objects to Registry

    Having a write method in Registry interface simplifies configuring Camel routes in CamelTestSupport
unit tests where a registry reference is not available and when you would like to configure
beans required by the components inside route builder's configure method.
    This change eliminates the need to pass registry references around. If your code can see
its CamelContext you'll have uniform write access to its registry.

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

    $ git pull registryWrite

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

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

    This closes #296
commit 74526552c9f51f8fdb5386b6456791ec1e57ac3c
Author: Jyrki Ruuskanen <>
Date:   2014-10-06T16:19:38Z

    Added add(String name, Object object) method to Registry


> Easier write access to Camel context registry
> ---------------------------------------------
>                 Key: CAMEL-7875
>                 URL:
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Jyrki Ruuskanen
>            Priority: Minor
> I haven't found a nice way to add beans to Camel context registry through Camel context
reference in plain Java. Some beans are only needed by a certain endpoint and it would make
sense to set the bean up with the endpoint in routebuilder configure method.
> If we added a reference to self in SimpleRegistry we could setup the Camel context by
DefaultCamelContext(new SimpleRegistry()) or OsgiDefaultCamelContext(bundleContext, new SimpleRegistry())
and easily access the registry from the routebuilder with SimpleRegistry registry = (SimpleRegistry)
> Then we can set up beans in routebuilder configure and simply add them with registry.put.
And the same routebuilder could be used in plain Java, in OSGi or elsewhere.
> All that is needed is this change in SimpleRegistry:
> {code}
> public static final String NAME;
> static {
>    NAME = java.util.UUID.randomUUID().tostring();
> }
> public SimpleRegistry() {
>    put.(NAME, this);
> }
> {code}

This message was sent by Atlassian JIRA

View raw message