Usage
NB: JRE 17 must be used to run the program.
CLI
The command line interface is internationalized: messages are available in French or English.
AgroMetInfo-SEASON-handler [-hV] [--verbose] --config=<PATH>
Description:
Log directory can be configured using the environment variable AGROMETINFO_LOGS. Default value: logs/.
--config=<PATH> Configuration file (.properties file)
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
--verbose Verbose mode
Exit codes:
0 Successful program execution. (notice leading space ' ')
64 Usage error: user input for the command was incorrect.
Default usage is:
$JAVA_HOME/bin/java -jar target/agrometinfo-season-handler-2.0.1.jar --config src/test/resources/config-good-with-stages.properties
Configuration file
The configuration file use the .properties
format.
A valid example is available in the test sources at src/test/resources/config-good-with-stages.properties
:
# AgroMetInfo-SEASON-handler configuration
## AgroMetInfo REST end point
rest.empty.cache.rest.url.0 = http://localhost:8080/www-server/rs/application/empty_cache
## SEASON simulations
simulation.path.0 = src/test/resources/simulation-good-with-stages.properties
## JMS configuration
# Set the InitialContextFactory class to use
java.naming.factory.initial = org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
# Use the following property to configure the default connector
# ActiveMQ
java.naming.provider.url = tcp://localhost:61616?reconnectAttempts=-1
queue.newSafranDataQueueLookup = agrometinfo-new-safran-data
queue.treatmentQueueLookup = treatment
queue.simulationDoneQueueLookup = simulation-done
queue.treatement.priority = 6
## Same as in running SEASON-cli.
season.results.table.owner = season
season.results.table.reader = season-read
## Persistence unit "simulation"
simulation.jakarta.persistence.jdbc.driver = org.postgresql.Driver
simulation.jakarta.persistence.jdbc.url = jdbc:postgresql://localhost/season?ApplicationName=agrometinfo-season-cli-dev
simulation.jakarta.persistence.jdbc.user = season
simulation.jakarta.persistence.jdbc.password = season
simulation.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
simulation.hibernate.show_sql = false
# Configuring Connection Pool
simulation.hibernate.connection.provider_class=org.hibernate.hikaricp.internal.HikariCPConnectionProvider
simulation.hibernate.hikari.minimumIdle = 2
simulation.hibernate.hikari.maximumPoolSize = 5
simulation.hibernate.hikari.idleTimeout = 30000
#
simulation.results.role.owner = season
simulation.results.role.reader = season-reader
NB: the JDBC user must be granted to read agrometinfo schema and write into agrometinfo.dailyvalue table.
SEASON simulations
To change the SEASON simulation to run each time a new SAFRAN integration is done, simply change the path simulation.path.0
.
To add a second SEASON simulation, add a new path with simulation.path.1
, and so on for other simulations.
The SEASON simulation format is described in the SEASON sources at src/site/markdown/simulationproperties.md
.
Runtime configuration
The other lines are for the configuration of JMS, JDBC and SEASON database roles and connection. This configuration must be adapted to the environment.
Asking AgroMetInfo-SEASON-handler for a new date
To run the simulation with a new date, use scripts/send-safran-date.sh
.
Usages:
scripts/send-safran-date.sh -h
# to compute for pre-production with the date 2024-08-27
scripts/send-safran-date.sh -p 2024-08-27
# to compute each date of phases
scripts/send-safran-date.sh -c -p 2024-08-27
# non interactive mode
scripts/send-safran-date.sh -c -f -p 2024-08-27