Hi Steinar,

I don’t think it’s possible and I don’t think it’s a good idea to do that with 
SCR. The component state is evaluate at activate.

I would rather create a custom controller service acting as a service factory 
when the HTTP requests come.

Regards
JB

> Le 29 août 2020 à 18:41, Steinar Bang <[email protected]> a écrit :
> 
> Is it possible to have a DS component to only go active when an HTTP
> request is successfully completed?
> 
> Here is what I want to do:
> 1. Have a DS component that exposes a service of type PreHook
> 2. The PreHook service is picked up by jdbc-config and is used to
>    create a schema in a JDBC database and populate the database with
>    initial data
> 3. The DS component does an HTTP call to get a liquibase changeset
>    containing data for the database
> 4. If the HTTP call fails for some reason (wrong URL, No URL, server
>    not responding, server responding with error code etc.) I would like
>    the DS component to log the reason for failing but not go ACTIVE
> 
> Is this possible?  Recommended?  Not recommended?
> 
> It's OK for me if this DS component won't automatically restart, because
> a failure in loading the URL will be so drastic that I might as well
> restart the world (ie. restart karaf).
> 
> Thanks!
> 
> 
> - Steinar
> 

Reply via email to