<commit_before># Module Launcher

The Module Launcher provides a single entry point that bootstraps module JARs located in a home directory. A single Docker image that contains such a directory of module JARs can then be used to launch any of those JARs based on an environment variable. When running standalone, a system property may be used instead of an environment variable, so that multiple instances of the Module Launcher may run on a single machine. The following examples demonstrate running the modules for the *ticktock* stream (`time | log`).

## Prerequisites

1: clone and build the spring-cloud-stream project:

````
git clone https://github.com/spring-cloud/spring-cloud-stream.git
cd spring-cloud-stream
mvn -s .settings.xml package
cd ..
````

2: copy the spring-cloud-stream source and sink sample JARs to `/opt/spring/modules`:

````
mkdir -p /opt/spring/modules
cp spring-cloud-stream/spring-cloud-stream-samples/source/target/spring-cloud-stream-sample-source-1.0.0.BUILD-SNAPSHOT-exec.jar /opt/spring/modules/time.jar
cp spring-cloud-stream/spring-cloud-stream-samples/sink/target/spring-cloud-stream-sample-sink-1.0.0.BUILD-SNAPSHOT-exec.jar /opt/spring/modules/log.jar
````

3: start redis locally via `redis-server` (optionally start `redis-cli` and use the `MONITOR` command to watch activity)

## Running Standalone

From the `spring-cloud-stream/spring-cloud-stream-module-launcher` directory:

````
java -Dmodules=time -jar target/spring-cloud-stream-module-launcher-1.0.0.BUILD-SNAPSHOT-exec.jar
java -Dmodules=log -jar target/spring-cloud-stream-module-launcher-1.0.0.BUILD-SNAPSHOT-exec.jar
````<commit_msg>Note on how to work around redis local binding.<commit_after># Module Launcher

The Module Launcher provides a single entry point that bootstraps module JARs located in a home directory. A single Docker image that contains such a directory of module JARs can then be used to launch any of those JARs based on an environment variable. When running standalone, a system property may be used instead of an environment variable, so that multiple instances of the Module Launcher may run on a single machine. The following examples demonstrate running the modules for the *ticktock* stream (`time | log`).

## Prerequisites

1: clone and build the spring-cloud-stream project:

````
git clone https://github.com/spring-cloud/spring-cloud-stream.git
cd spring-cloud-stream
mvn -s .settings.xml package
cd ..
````

2: copy the spring-cloud-stream source and sink sample JARs to `/opt/spring/modules`:

````
mkdir -p /opt/spring/modules
cp spring-cloud-stream/spring-cloud-stream-samples/source/target/spring-cloud-stream-sample-source-1.0.0.BUILD-SNAPSHOT-exec.jar /opt/spring/modules/time.jar
cp spring-cloud-stream/spring-cloud-stream-samples/sink/target/spring-cloud-stream-sample-sink-1.0.0.BUILD-SNAPSHOT-exec.jar /opt/spring/modules/log.jar
````

3: start redis locally via `redis-server` (optionally start `redis-cli` and use the `MONITOR` command to watch activity)

*NOTE:* redis.conf (on OSX it is found here: /usr/local/etc/redis.conf) may need to be updated to set the binding to an address other than 127.0.0.1 else the docker instances will fail to connect. For example: bind 0.0.0.0

## Running Standalone

From the `spring-cloud-stream/spring-cloud-stream-module-launcher` directory:

````
java -Dmodules=time -jar target/spring-cloud-stream-module-launcher-1.0.0.BUILD-SNAPSHOT-exec.jar
java -Dmodules=log -jar target/spring-cloud-stream-module-launcher-1.0.0.BUILD-SNAPSHOT-exec.jar
````
{'fraction_non_alphanumeric': 0.107687959299039, 'fraction_numerical': 0.011305822498586773, 'mean_word_length': 4.46141975308642, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '405167', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1074, 'n_words': 358}