Commit 8e8a84bd authored by Tobinsk's avatar Tobinsk
Browse files

Merge branch 'master' into 'provider-slugs'

# Conflicts:
#   Readme.md
parents 91ea6c95 d38bc9b4
# Geolinker common
This simple lib just bundle modules for the geolinker. Over a core instance you can access kafka-consumers, kafka-producers, reporter, logger, config and uriBuilder. This tools are used in most of the streaming app and so we can stop replicating code - at least a bit.
This simple lib just bundle modules for the geolinker. Over a core instance you can access kafka-consumers, kafka-producers, reporter, logger, config and uriBuilder. These tools are used in most of the streaming app and allow us to stop replicating code - at least a bit.
## Config
All streaming apps provides a common config-file. Over this file you can configure the different modules and then access an instance over the core. The configs makes use of the [nconf](https://www.npmjs.com/package/nconf) module. A typical config looks like
All streaming apps provide a common config-file. In this file you can configure the different modules and then access an instance over the core. The config makes use of the [nconf](https://www.npmjs.com/package/nconf) module. A typical config looks like this:
```json
{
"kafka": {
......@@ -71,7 +71,7 @@ You can configure several producers in one file. You need to prefix the config w
}
}
```
If you just need a single producer for the app (common case), you can leave the prefix and just go with following config
If you just need a single producer for the app (common case), you can omit the prefix and just go with following config
```json
{
"producer": {
......@@ -148,10 +148,10 @@ As a logger we use [winston](https://www.npmjs.com/package/winston). We use two
"log-dir": "/tmp"
}
```
Todo: We should delete the file transport. This malkes conflicts in containers.
Todo: We should delete the file transport. This creates conflicts in containers.
### Reporter config (deprecated)
The reporter is deprecated. We will delete it in the next version.
The status reporter need to get an address from the config to report.
The status reporter needs to get an address from the config to report.
```json
{
"reporter": {
......@@ -162,7 +162,7 @@ The status reporter need to get an address from the config to report.
* url: The url of the reporter
## Core
The `core` is a container with instances or factories to provide the service. You can inject the core into a class to have access to the services. So you get one instance over the project.
The `core` is a container with instances or factories to provide the service. You can inject the core into a class to gain access to the services. So you get one instance over the project.
```js
const core = Core.init(name, configFilePath);
```
......@@ -187,7 +187,7 @@ core.getReporter(10000, 'example').setDataIn(10);
core.getReporter('example').setDataOut(5);
```
## Kafka
The kafka class uses [kafka-avro](https://github.com/waldophotos/kafka-avro) module to provide kafka and [avro schemas](https://avro.apache.org/docs/1.8.1/spec.html). We just unified the method to configure and init kafka, consumers and producers.
The kafka class uses the [kafka-avro](https://github.com/waldophotos/kafka-avro) module to provide kafka and [avro schemas](https://avro.apache.org/docs/1.8.1/spec.html). We just unified the method to configure and init kafka, consumers and producers.
The class gets the configuration from `nconf`. There we can configure all details for each consumer and producer.
```js
const core = Core.init(name, configFilePath);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment