Start Service on Ofbiz Startup

2020-01-28 Thread Ingo Wolfmayr
Hi everybody,

is it possible to start a service when Ofbiz has started and is ready?

Use case: I need to startup a connection to an external storage system. In my 
case a TCP/IP connection that is permanent.

Best regards,
Ingo




Re: Start Service on Ofbiz Startup

2020-01-28 Thread Gil Portenseigne
Hello Ingo,

For this case, i think I would plan a job to run every X minutes, that
will check if the connexion is alive or, establish it.

The jobPoller will then take care of it after OFBiz is launched.
Depending on the connexion type it might be enough.

AFAIK there is no standard configuration to launch a service at OFBiz
start.

Gil

On Tue, Jan 28, 2020 at 10:58:14AM +0100, Ingo Wolfmayr wrote:
> Hi everybody,
> 
> is it possible to start a service when Ofbiz has started and is ready?
> 
> Use case: I need to startup a connection to an external storage system. In my 
> case a TCP/IP connection that is permanent.
> 
> Best regards,
> Ingo
> 
> 


signature.asc
Description: PGP signature


Re: Start Service on Ofbiz Startup

2020-01-28 Thread Michael Brohl
Is it important to establish the connection to the external storage 
system only after OFBiz has been startet?


Can it be established beforehand? If yes, I would either startup the 
connection in your OFBiz start script or completely independend of OFBiz 
on the server level (mounting on startup).


Michael Brohl

ecomify GmbH - www.ecomify.de


Am 28.01.20 um 11:06 schrieb Gil Portenseigne:

Hello Ingo,

For this case, i think I would plan a job to run every X minutes, that
will check if the connexion is alive or, establish it.

The jobPoller will then take care of it after OFBiz is launched.
Depending on the connexion type it might be enough.

AFAIK there is no standard configuration to launch a service at OFBiz
start.

Gil

On Tue, Jan 28, 2020 at 10:58:14AM +0100, Ingo Wolfmayr wrote:

Hi everybody,

is it possible to start a service when Ofbiz has started and is ready?

Use case: I need to startup a connection to an external storage system. In my
case a TCP/IP connection that is permanent.

Best regards,
Ingo






smime.p7s
Description: S/MIME Cryptographic Signature


Re: Start Service on Ofbiz Startup

2020-01-28 Thread Ingo Wolfmayr
Hello Gil,

that was my first try either, unfortunately that is not working as when I 
restart Ofbiz, the service may crash and due to restarting a new pending job 
will not be created. So the service status has to be reviewed everytime the 
server is restarted and a new  new job has to be created. If the server is 
restarted for some reasons Ofbiz will startup automatically but I want to 
avoid having dependencies on someone checking the service -  or calling me to 
do it.

Thanks for your thoughts!

Best regards,
Ingo

Am Dienstag, 28. Jänner 2020, 11:06:15 CET schrieb Gil Portenseigne:
> Hello Ingo,
> 
> For this case, i think I would plan a job to run every X minutes, that
> will check if the connexion is alive or, establish it.
> 
> The jobPoller will then take care of it after OFBiz is launched.
> Depending on the connexion type it might be enough.
> 
> AFAIK there is no standard configuration to launch a service at OFBiz
> start.
> 
> Gil
> 
> On Tue, Jan 28, 2020 at 10:58:14AM +0100, Ingo Wolfmayr wrote:
> > Hi everybody,
> > 
> > is it possible to start a service when Ofbiz has started and is ready?
> > 
> > Use case: I need to startup a connection to an external storage system. In
> > my case a TCP/IP connection that is permanent.
> > 
> > Best regards,
> > Ingo





Re: Start Service on Ofbiz Startup

2020-01-28 Thread Ingo Wolfmayr
Yes it is important as the external storage, in my case an automatic storage 
system, sends messages to Ofbiz if inventory is requested. If it has the 
information that the connection is established, but unaware that Ofbiz is not 
ready it will run into problems - or makes it more complicated. 
I guess I will have to add the service database entries via the startup 
script. I was hoping to find a "cleaner" way, telling ofbiz to do something 
when ready.

Thanks for the input.
Ingo

Am Dienstag, 28. Jänner 2020, 11:14:03 CET schrieb Michael Brohl:
> Is it important to establish the connection to the external storage
> system only after OFBiz has been startet?
> 
> Can it be established beforehand? If yes, I would either startup the
> connection in your OFBiz start script or completely independend of OFBiz
> on the server level (mounting on startup).
> 
> Michael Brohl
> 
> ecomify GmbH - www.ecomify.de
> 
> Am 28.01.20 um 11:06 schrieb Gil Portenseigne:
> > Hello Ingo,
> > 
> > For this case, i think I would plan a job to run every X minutes, that
> > will check if the connexion is alive or, establish it.
> > 
> > The jobPoller will then take care of it after OFBiz is launched.
> > Depending on the connexion type it might be enough.
> > 
> > AFAIK there is no standard configuration to launch a service at OFBiz
> > start.
> > 
> > Gil
> > 
> > On Tue, Jan 28, 2020 at 10:58:14AM +0100, Ingo Wolfmayr wrote:
> >> Hi everybody,
> >> 
> >> is it possible to start a service when Ofbiz has started and is ready?
> >> 
> >> Use case: I need to startup a connection to an external storage system.
> >> In my case a TCP/IP connection that is permanent.
> >> 
> >> Best regards,
> >> Ingo





Re: Start Service on Ofbiz Startup

2020-01-28 Thread James Yong
Hi Ingo,

You can implement an OFBiz Container and declare it in your custom 
ofbiz-component.xml file.
Also see Container.java from the sources.

Another possible solution is to implement ServletContextListener and declare it 
in your custom web.xml file.

Regards,
James 

On 2020/01/28 09:58:14, Ingo Wolfmayr  wrote: 
> Hi everybody,
> 
> is it possible to start a service when Ofbiz has started and is ready?
> 
> Use case: I need to startup a connection to an external storage system. In my 
> case a TCP/IP connection that is permanent.
> 
> Best regards,
> Ingo
> 
> 
> 


Re: Start Service on Ofbiz Startup

2020-01-28 Thread Deepak Dixit
Hi Ingo,

Please check the serviecengine.xml, you can define the startup-service
there, I think this will fulfill your requirements

===


==

Kind Regards,
Deepak Dixit
DIRECTOR OF PRODUCT ENGINEERING
mobile: +91 9826754548
email: deepak.di...@hotwax.co
*www.hotwax.co *


On Tue, Jan 28, 2020 at 9:12 PM James Yong  wrote:

> Hi Ingo,
>
> You can implement an OFBiz Container and declare it in your custom
> ofbiz-component.xml file.
> Also see Container.java from the sources.
>
> Another possible solution is to implement ServletContextListener and
> declare it in your custom web.xml file.
>
> Regards,
> James
>
> On 2020/01/28 09:58:14, Ingo Wolfmayr  wrote:
> > Hi everybody,
> >
> > is it possible to start a service when Ofbiz has started and is ready?
> >
> > Use case: I need to startup a connection to an external storage system.
> In my
> > case a TCP/IP connection that is permanent.
> >
> > Best regards,
> > Ingo
> >
> >
> >
>


Re: Start Service on Ofbiz Startup

2020-01-29 Thread Ingo Wolfmayr
Hi James,

I decided to go with the ServletContextListener. It does exactly what I need.

Thanks a lot!
Best regards,
Ingo

Am Dienstag, 28. Jänner 2020, 16:42:28 CET schrieb James Yong:
> Hi Ingo,
> 
> You can implement an OFBiz Container and declare it in your custom
> ofbiz-component.xml file. Also see Container.java from the sources.
> 
> Another possible solution is to implement ServletContextListener and declare
> it in your custom web.xml file.
> 
> Regards,
> James
> 
> On 2020/01/28 09:58:14, Ingo Wolfmayr  wrote:
> > Hi everybody,
> > 
> > is it possible to start a service when Ofbiz has started and is ready?
> > 
> > Use case: I need to startup a connection to an external storage system. In
> > my case a TCP/IP connection that is permanent.
> > 
> > Best regards,
> > Ingo





Re: Start Service on Ofbiz Startup

2020-01-29 Thread Ingo Wolfmayr
Hi Deepak,

thanks for the info. I will also give it a try. 

Thanks a lot!

Best regards,
Ingo

Am Dienstag, 28. Jänner 2020, 20:46:42 CET schrieb Deepak Dixit:
> Hi Ingo,
> 
> Please check the serviecengine.xml, you can define the startup-service
> there, I think this will fulfill your requirements
> 
> ===
> 
> 
> ==
> 
> Kind Regards,
> Deepak Dixit
> DIRECTOR OF PRODUCT ENGINEERING
> mobile: +91 9826754548
> email: deepak.di...@hotwax.co
> *www.hotwax.co *
> 
> On Tue, Jan 28, 2020 at 9:12 PM James Yong  wrote:
> > Hi Ingo,
> > 
> > You can implement an OFBiz Container and declare it in your custom
> > ofbiz-component.xml file.
> > Also see Container.java from the sources.
> > 
> > Another possible solution is to implement ServletContextListener and
> > declare it in your custom web.xml file.
> > 
> > Regards,
> > James
> > 
> > On 2020/01/28 09:58:14, Ingo Wolfmayr  wrote:
> > > Hi everybody,
> > > 
> > > is it possible to start a service when Ofbiz has started and is ready?
> > > 
> > > Use case: I need to startup a connection to an external storage system.
> > 
> > In my
> > 
> > > case a TCP/IP connection that is permanent.
> > > 
> > > Best regards,
> > > Ingo