Djiby Thiaw
Djiby Thiaw

Reputation: 213

wildfly maven plugin add datasource with pool size

I am using wildfly maven plugin to add datasource in my standalone.xml file. I want also to add the pool size that will be something like that in the standalone file:

<pool>
  <min-pool-size>10</min-pool-size>
  <max-pool-size>30</max-pool-size>
  <prefill>true</prefill>
</pool>

How can I do that in my goal in the pom.xml ?

Upvotes: 1

Views: 494

Answers (1)

Steve C
Steve C

Reputation: 19445

One way to do this is to create a script called config.cli and add the following content to it:

# Mark the commands below to be run as a batch
batch

# Add the application datasource (this example is for PostgreSQL)
data-source add \
    --name=YourDS \
    --driver-name=postgresql-9.4-1206-jdbc42.jar \
    --connection-url=jdbc:postgresql://yourdb:5432/yourdb \
    --jndi-name=java:jboss/datasources/YourDS \
    --user-name=username \
    --password=password \
    --use-ccm=false \
    --min-pool-size=10 \
    --max-pool-size=30 \
    --pool-prefill=true \
    --blocking-timeout-wait-millis=5000 \
    --new-connection-sql="set datestyle = ISO, European;"

# Execute the batch
run-batch

and then execute it using the wildfly-maven-plugin:

        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>1.1.0.Beta1</version>
            <configuration>
                <scripts>
                    <script>config.cli</script>
                </scripts>
            </configuration>
        </plugin>

Upvotes: 2

Related Questions