## Getting Started

This chapter takes you through the first steps of getting {wildfly-camel} and provides the initial pointers to get up and running.

[discrete]
### Download the Distribution

WildFly-Camel is distributed as

1. WildFly Patch - https://github.com/wildflyext/wildfly-camel/releases[wildfly-camel-patch]
2. Docker Image - https://registry.hub.docker.com/u/wildflyext/wildfly-camel/[wildflyext/wildfly-camel]


[discrete]
### Installing the Camel Subsystem

Simply unpack the provided patch into the a supported WildFly installation. For possible WildFly target versions, see the link:index.html#_compatibility[compatibility page].

[discrete]
### Standalone Server

In your {wildfly} home directory run ...

[options="nowrap"]
 $ bin/standalone.sh -c standalone-camel.xml
 ...
 10:50:02,833 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 31) JBAS018559: Deployed "wildfly-camel.war" (runtime-name : "wildfly-camel.war")
 10:50:02,834 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 31) JBAS018559: Deployed "hawtio.war" (runtime-name : "hawtio.war")
 10:50:02,848 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
 10:50:02,849 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
 10:50:02,849 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.1.0.Final "Kenny" started in 10804ms

[discrete]
### Domain Mode

Similarly, for the WildFly Domain Mode run ...

[options="nowrap"]
 $ bin/domain.sh -c domain-camel.xml

[discrete]
### Enable Camel Subsystem

The patch does not modify existing configuration files. Instead it comes with a number of additional configurations files that end in `-camel.xml`.

If you should want to add the Camel subsystem to existing configurations you can run the following command.

[options="nowrap"]
    $ java -jar ${JBOSS_HOME}/jboss-modules.jar -mp ${JBOSS_HOME}/modules org.wildfly.extras.config --configs camel --enable

    Processing config for: camel
    Writing 'layers=fuse' to: .../wildfly-15.0.1.Final/modules/layers.conf
    Enable camel configuration in: .../wildfly-15.0.1.Final/standalone/configuration/standalone.xml
    Enable camel configuration in: .../wildfly-15.0.1.Final/standalone/configuration/standalone-full.xml
    Enable camel configuration in: .../wildfly-15.0.1.Final/standalone/configuration/standalone-full-ha.xml
    Enable camel configuration in: .../wildfly-15.0.1.Final/standalone/configuration/standalone-ha.xml
    Enable camel configuration in: .../wildfly-15.0.1.Final/domain/configuration/domain.xml

There are currently four triggers that can be used to enable Camel for a deployment

1. a deployment that contains a *-camel-context.xml descriptor
2. a deployment that contains a type annotated with `@CamelAware`
3. a deployment that contains a type annotated with `@ContextName`
4. a deployment that contains a type annotated with `@ImportResource`

[discrete]
### Docker Image

The easiest and most portable way to run {wildfly-camel} is to use the https://registry.hub.docker.com/u/wildflyext/wildfly-camel[wildflyext/wildfly-camel] distribution.

[options="nowrap"]
 $ docker run --rm -ti -p 8080:8080 -p 9990:9990 -e WILDFLY_MANAGEMENT_USER=admin -e WILDFLY_MANAGEMENT_PASSWORD=admin wildflyext/wildfly-camel

[discrete]
### Maven Archetypes

To get started with writing Camel JEE applications, there are two Maven archetypes that can generate either a Camel Spring XML or Camel CDI application.

To generate a Camel CDI application, run the following from the command line.

[source,options="nowrap",subs="attributes"]
mvn archetype:generate -DarchetypeGroupId=org.wildfly.camel.archetypes \
                       -DarchetypeArtifactId=wildfly-camel-archetype-cdi \
                       -DarchetypeVersion={version} \
                       -DgroupId=com.mycompany \
                       -DartifactId=my-camel-cdi-application

To generate a Camel Spring XML application, run the following from the command line.

[source,options="nowrap",subs="attributes"]
mvn archetype:generate -DarchetypeGroupId=org.wildfly.camel.archetypes \
                       -DarchetypeArtifactId=wildfly-camel-archetype-spring \
                       -DarchetypeVersion={version} \
                       -DgroupId=com.mycompany \
                       -DartifactId=my-camel-spring-application

Instructions on how to build, test and run the project can be found within the generated README files.
