Hi, 
My solution looks like this:

I have created a small context with those jaxb dataformats and corresponding 
routes which are calling (un)marshall.
These routes are connected by vm: endpoints and use InOut-Pattern.
So I have all XSDs, jaxb generation and jaxb-dataformat in one bundle which is 
a dependency to all other bundles which use the XSDs/dataformats.

The only drawback is for testing that these marshalling routes have to be 
mocked up because I cannot have two Blueprint Camel contexts in one Camel test.
This could be done by adviceWith or -what I have done - I use context.addRoutes 
in my test class:
    @Override
    @Before
    public void setUp() throws Exception {
        super.setUp();
        context.addRoutes( new MyCoreOsgiRouteBuilder( context));
    }

    private static final class MyCoreOsgiRouteBuilder extends RouteBuilder {
        @Override
        public void configure() throws Exception {
            final JaxbDataFormat dataFormat = new JaxbDataFormat( ".....");
                ....
            from( "vm:core.unmarshall.source").unmarshal( dataFormat);
        }
    }

Greetings
Karsten
-----Original Message-----
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Freitag, 12. April 2019 12:14
To: users@camel.apache.org
Subject: Re: Sharing Dataformat between bundles

Hi

No a data format is per camel context, and ditto for components etc.

You can create your own osgi service with some jaxb stuff that does similar to 
this and share it. Since its standard JAXB then it should not be as hard to do.

But mind the more fine grained osgi services you have the more complex your 
apps lifecycles are as they are then all depend on this same service.



On Fri, Apr 12, 2019 at 11:55 AM Blume, Karsten 
<karsten.bl...@hermes-ottoint.com> wrote:
>
> Hi,
> i was scared somebody saying something like this.
> This is a bunch of several XSDs which results in > 400 classes being 
> generated.
> I would like to avoid this maintenance horror, keeping every bundles XSDs, 
> maven config in sync.
>
> No possibility?
> Karsten



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to