Hello again.

This seems to be very interesting but I have no idea about defining
and using managed service factories. Some examples perhaps, please ?

To be sure we share the same goal, I attach the blueprint of my POC.
This blueprint today just provides a simplified custom information
service and data sources, and it should be adapted/replaced to avoid
its multiplication for every managed entity.

Thanks a lot for your help.

Regards.

Le mer. 30 nov. 2022 à 17:13, Jean-Baptiste Onofré <[email protected]> a écrit :
>
> You can have managed service factory: one instance per configuration.
>
> It's the way it works in Decanter: you can create multiple
> elasticsearch collector "attached" to a configuration.
>
> Regards
> JB
>
> On Wed, Nov 30, 2022 at 4:29 PM Ephemeris Lappis
> <[email protected]> wrote:
> >
> > Hello.
> >
> > Not sure this could work. If all my blueprints and beans/services
> > objects are defined in the "core feature" bundles, only one instance
> > of them is created, no ?
> > How could I multiply blueprint containers as many times as I have a
> > configuration for business entities ?
> >
> > I've already designed my works with a common "core feature" that pulls
> > the common features (blueprint, transaction, etc.)  and bundles
> > (beans, database drivers, and so on), and plan to use it from other
> > features. But I found no way to share blueprints...
> >
> > Thanks for your help.
> >
> > Regards.
> >
> > Le mer. 30 nov. 2022 à 16:00, Matt Pavlovich <[email protected]> a écrit :
> > >
> > > Yes, you would create 1 feature for the jars to provide the functionality 
> > > and then a feature per-configuration. The ‘configuration features’ would 
> > > only contain cfg files (instead of jars) to activate the services with 
> > > different configurations.
> > >
> > > -Matt
> > >
> > > > On Nov 30, 2022, at 6:15 AM, Ephemeris Lappis 
> > > > <[email protected]> wrote:
> > > >
> > > > Hello.
> > > >
> > > > I'm almost sure that my question will seem stupid and perhaps leads to
> > > > ironic answers...
> > > >
> > > > I'd like to build a feature to define some "templated" services (JDBC
> > > > data sources for example, or custom services), that should be exactly
> > > > based on the same definition, but must be instantiated multiple times
> > > > with distinct configurations. The goal in our global ESB platform is
> > > > to provide generic Camel routes that will run for an undefined number
> > > > of business entities. Each entity could be deployed as a feature with
> > > > its own configuration. Some of the global services use the whiteboard
> > > > pattern to collect implementations for any number of businesses.
> > > >
> > > > The trivial way could be copying a full project to build as many
> > > > features as needed, but this is not a very good way to avoid
> > > > duplicated code and maintain them...
> > > >
> > > > Any ideas on how to do that ?
> > > >
> > > > Thanks a lot.
> > > >
> > > > Regards.
> > >
<?xml version="1.0" encoding="UTF-8"?>

<blueprint
	xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
	xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
							http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
						http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
							http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd";>

	<bean
		id="entityBean"
		class="my.tests.t29.bean.EntityConfigurationBean">
		<argument value="${my.entity.key}" />
		<argument value="Entity ${my.entity.key}" />
		<argument value="${my.entity.base-url}" />
	</bean>

	<service
		id="entityService"
		interface="my.tests.t29.EntityConfiguration"
		ref="entityBean">
		<service-properties>
			<entry
				key="the.entity.key"
				value="${my.entity.key}" />
		</service-properties>
	</service>
	
	<bean
		id="dsBean"
		class="org.postgresql.xa.PGXADataSource">
		<property
			name="serverName"
			value="${my.ds.server-name}" />
		<property
			name="portNumber"
			value="${my.ds.server-port}" />
		<property
			name="databaseName"
			value="${my.ds.database-name}" />
		<property
			name="user"
			value="${my.ds.user-name}" />
		<property
			name="password"
			value="${my.ds.user-password}" />
		<property
			name="applicationName"
			value="${my.ds.application-name}" />
		<property
			name="defaultRowFetchSize"
			value="5" />
	</bean>

	<service
		interface="javax.sql.XADataSource"
		ref="dsBean">
		<service-properties>
			<entry
				key="osgi.jndi.service.name"
				value="jdbc/entity/${my.entity.key}" />
			<entry
				key="datasource.name"
				value="postgresql-${my.entity.key}" />
			<entry
				key="aries.xa.name"
				value="XA-${my.entity.key}" />
           <entry
                key="aries.xa.pooling"
                value="true" />
            <entry
                key="aries.xa.poolMinSize"
                value="${my.ds.pool-initital}" />
            <entry
                key="aries.xa.poolMaxSize"
                value="${my.ds.pool-maximum}" />
 		</service-properties>
	</service>

</blueprint>

Reply via email to