You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Karl Kildén <ka...@gmail.com> on 2017/11/27 15:27:03 UTC

Adding a new datasource during runtime?

Hello!

For production we use tomee.xml and for development resources.xml and are
very happy.


Our next app to convert to tomee is multi-tenant with a hard requirement on
logical separation so we will need a Router and dynamic datasources. This
is also working very well in my tests.

We will have hundreds of datasources and a restart to add a new one is not
efficient enough.

- Can we centralize the resource definitions?
- Can we reload the definitions if we add a new one during runtime?


Cheers

Re: Adding a new datasource during runtime?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
being managed is not that hard, you can check
https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/managed/JTADataSourceWrapperFactory.java
out

Romain Manni-Bucau
@rmannibucau |  Blog | Old Blog | Github | LinkedIn


2017-11-27 16:54 GMT+01:00 Paul Carter-Brown <pa...@smilecoms.com>:
> Hi Karl,
>
> Do you know at build/deploy time what drivers you will be using (e.g.
> MySQL, Postgres etc). If so it would probably be easiest to point a set of
> datasources to HAProxy on say port 10000, 10001 etc and then do the runtime
> setup on HAProxy by configuring the frontend to backend mappings as you
> wish. This also gives you the ability to do automatic failover etc
>
> On 27 November 2017 at 17:50, Karl Kildén <ka...@gmail.com> wrote:
>
>> Hi,
>>
>> Thanks for the idea. And to have it jta managed etc? Anything I need to
>> think about to make it behave as normal. No source in front of me now but
>> maybe enough to use correct datasource impl?
>>
>> Skickat från min iPhone
>>
>> > 27 nov. 2017 kl.  16:42 skrev Romain Manni-Bucau <rmannibucau@gmail.com
>> >:
>> >
>> > Hi
>> >
>> > if you have a router impl you can just use your own datasource manager
>> > behind it and manage it the way you want no?
>> >
>> > Romain Manni-Bucau
>> > @rmannibucau |  Blog | Old Blog | Github | LinkedIn
>> >
>> >
>> > 2017-11-27 16:27 GMT+01:00 Karl Kildén <ka...@gmail.com>:
>> >> Hello!
>> >>
>> >> For production we use tomee.xml and for development resources.xml and
>> are
>> >> very happy.
>> >>
>> >>
>> >> Our next app to convert to tomee is multi-tenant with a hard
>> requirement on
>> >> logical separation so we will need a Router and dynamic datasources.
>> This
>> >> is also working very well in my tests.
>> >>
>> >> We will have hundreds of datasources and a restart to add a new one is
>> not
>> >> efficient enough.
>> >>
>> >> - Can we centralize the resource definitions?
>> >> - Can we reload the definitions if we add a new one during runtime?
>> >>
>> >>
>> >> Cheers
>>
>
>
>
> --
>
> *Paul Carter-Brown*
>
> *Group Chief Information Officer*
>
> *Smile Communications Pty (Ltd)       *
> Smile +234 (0) 702 000 1234
> Mobile +27 (0) 83 4427 179
> Skype PaulC-B
> paul.carter-brown@smilecoms.com
> www.smilecoms.com
>
> --
>
>
> This email is subject to the disclaimer of Smile Communications at http://www.smilecoms.com/home/email-disclaimer/ <http://www.smilecoms.com/disclaimer>
>

Re: Adding a new datasource during runtime?

Posted by Paul Carter-Brown <pa...@smilecoms.com>.
Hi Karl,

Do you know at build/deploy time what drivers you will be using (e.g.
MySQL, Postgres etc). If so it would probably be easiest to point a set of
datasources to HAProxy on say port 10000, 10001 etc and then do the runtime
setup on HAProxy by configuring the frontend to backend mappings as you
wish. This also gives you the ability to do automatic failover etc

On 27 November 2017 at 17:50, Karl Kildén <ka...@gmail.com> wrote:

> Hi,
>
> Thanks for the idea. And to have it jta managed etc? Anything I need to
> think about to make it behave as normal. No source in front of me now but
> maybe enough to use correct datasource impl?
>
> Skickat från min iPhone
>
> > 27 nov. 2017 kl.  16:42 skrev Romain Manni-Bucau <rmannibucau@gmail.com
> >:
> >
> > Hi
> >
> > if you have a router impl you can just use your own datasource manager
> > behind it and manage it the way you want no?
> >
> > Romain Manni-Bucau
> > @rmannibucau |  Blog | Old Blog | Github | LinkedIn
> >
> >
> > 2017-11-27 16:27 GMT+01:00 Karl Kildén <ka...@gmail.com>:
> >> Hello!
> >>
> >> For production we use tomee.xml and for development resources.xml and
> are
> >> very happy.
> >>
> >>
> >> Our next app to convert to tomee is multi-tenant with a hard
> requirement on
> >> logical separation so we will need a Router and dynamic datasources.
> This
> >> is also working very well in my tests.
> >>
> >> We will have hundreds of datasources and a restart to add a new one is
> not
> >> efficient enough.
> >>
> >> - Can we centralize the resource definitions?
> >> - Can we reload the definitions if we add a new one during runtime?
> >>
> >>
> >> Cheers
>



-- 

*Paul Carter-Brown*

*Group Chief Information Officer*

*Smile Communications Pty (Ltd)       *
Smile +234 (0) 702 000 1234
Mobile +27 (0) 83 4427 179
Skype PaulC-B
paul.carter-brown@smilecoms.com
www.smilecoms.com

-- 


This email is subject to the disclaimer of Smile Communications at http://www.smilecoms.com/home/email-disclaimer/ <http://www.smilecoms.com/disclaimer>


Re: Adding a new datasource during runtime?

Posted by Karl Kildén <ka...@gmail.com>.
Hi,

Thanks for the idea. And to have it jta managed etc? Anything I need to think about to make it behave as normal. No source in front of me now but maybe enough to use correct datasource impl?

Skickat från min iPhone

> 27 nov. 2017 kl.  16:42 skrev Romain Manni-Bucau <rm...@gmail.com>:
> 
> Hi
> 
> if you have a router impl you can just use your own datasource manager
> behind it and manage it the way you want no?
> 
> Romain Manni-Bucau
> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
> 
> 
> 2017-11-27 16:27 GMT+01:00 Karl Kildén <ka...@gmail.com>:
>> Hello!
>> 
>> For production we use tomee.xml and for development resources.xml and are
>> very happy.
>> 
>> 
>> Our next app to convert to tomee is multi-tenant with a hard requirement on
>> logical separation so we will need a Router and dynamic datasources. This
>> is also working very well in my tests.
>> 
>> We will have hundreds of datasources and a restart to add a new one is not
>> efficient enough.
>> 
>> - Can we centralize the resource definitions?
>> - Can we reload the definitions if we add a new one during runtime?
>> 
>> 
>> Cheers

Re: Adding a new datasource during runtime?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

if you have a router impl you can just use your own datasource manager
behind it and manage it the way you want no?

Romain Manni-Bucau
@rmannibucau |  Blog | Old Blog | Github | LinkedIn


2017-11-27 16:27 GMT+01:00 Karl Kildén <ka...@gmail.com>:
> Hello!
>
> For production we use tomee.xml and for development resources.xml and are
> very happy.
>
>
> Our next app to convert to tomee is multi-tenant with a hard requirement on
> logical separation so we will need a Router and dynamic datasources. This
> is also working very well in my tests.
>
> We will have hundreds of datasources and a restart to add a new one is not
> efficient enough.
>
> - Can we centralize the resource definitions?
> - Can we reload the definitions if we add a new one during runtime?
>
>
> Cheers