online-auction-java
online-auction-java copied to clipboard
Start and stop ES using runAll hooks
Using the new feature (https://github.com/lagom/lagom/issues/762) allowing start and stop code to be hooked to runAll
, it'd be useful to take elasticsearch in online-auction as an example for the feature.
@ignasi35 As per I can understand from context what we will need to do is
- Check if ES of proper version is available to run. if not then download and install it.
- Check if ES is already running.
- If ES is not running then start the new instance.
- Clean instance if ant cleaning needed to be done.
- Stop ES when sbt is being terminated.
Please let me know which of these should exist in process and which are not needed. Also let me know if I missed something.
I think the example in the PR is quite illustrative: https://github.com/lagom/lagom/pull/763/files#diff-69be132232784c54f9b1cdfc434186af
I would build from that:
- if the folder
target/elasticsearch-5.0.2
doesn't exist, download and unzip there - don't check if it's already running and just execute the start command. It will fail on start and the user will have to deal with that.
- if
sbt clean
is invoked, alltarget
folder is removed so no need to add any code there.
Does that make sense?
@ignasi35 Where should we download ES so that it do not have to be re downloaded every time after sbt clean
I think we can do that on a separate PR.
@ignasi35 With which version of lagom comes the lagomInfrastructureServices
. I am not able to find it on lagom 1.3.4
Hi @lakhina the feature is only available in master
which means you will only see it if you compile lagom locally and make your PR depend on 1.4.0-SNAPSHOT
.
@ignasi35 So should I upgrade online-auction to 1.4.0-SNAPSHOT
or I should wait for this feature to come in stable version?
Realized just now that SNAPSHOT do not exist as remote lib so I guess we should wait for stable version to add this feature to online auction. What do you say?
This will not be mergeable until 1.4.0
is out, but in the meantime you can clone lagom/lagom
and use publishLocal
in sbt to test your changes. ;-)
@ignasi35 okay thanks. I am on it