Skip to content

Commit

Permalink
Merge pull request #34 from th2-net/dev-version-5
Browse files Browse the repository at this point in the history
Merge dev-version-5 to master
  • Loading branch information
Nikita-Smirnov-Exactpro authored May 1, 2024
2 parents e6e4866 + 4d3d663 commit 7b29a44
Show file tree
Hide file tree
Showing 20 changed files with 1,161 additions and 827 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build-dev-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build and publish dev release Docker image to Github Container Registry ghcr.io and publish dev release jar to sonatype

on: workflow_dispatch

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Sonatype,Docker'
devRelease: true
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
19 changes: 19 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build and publish release Docker image to Github Container Registry ghcr.io and publish release jar to sonatype

on: workflow_dispatch

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Sonatype,Docker'
devRelease: false
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
24 changes: 24 additions & 0 deletions .github/workflows/build-sanpshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and publish Docker image to Github Container Registry ghcr.io and publish snapshot jar to sonatype

on:
push:
branches-ignore:
- master
- version-*
- dependabot**
paths-ignore:
- README.md

jobs:
build-job:
uses: th2-net/.github/.github/workflows/compound-java-dev.yml@main
with:
build-target: 'Sonatype,Docker'
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
19 changes: 0 additions & 19 deletions .github/workflows/dev-docker-publish.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/docker-publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gradle:6.6-jdk11 AS build
FROM gradle:7.6-jdk11 AS build
ARG release_version
COPY ./ .
RUN gradle build dockerPrepare \
Expand Down
96 changes: 72 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# Csv codec (4.1.0)
# Csv codec (5.3.0)

## Description
Designed for decode csv raw messages from csv reader to the parsed messages.
It is based on [th2-codec](https://github.com/th2-net/th2-codec).
You can find additional information [here](https://github.com/th2-net/th2-codec/blob/master/README.md)

Designed for decode csv raw messages from csv reader to the parsed messages. It is based
on [th2-codec](https://github.com/th2-net/th2-codec). You can find additional
information [here](https://github.com/th2-net/th2-codec/blob/master/README.md)

## Decoding

The codec decodes each raw message in the received batch.
Each raw message might contain several line in CSV format.
If the default header parameter is not set the codec trites the first line from the raw message as a header.
Otherwise, the default header will be used for decoding the rest of data.
Output message type is taken from `th2.csv.override_message_type` property in input message.
If the property missing, the default value (`Csv_Message`) for output message type is used.
The codec decodes each raw message in the received batch. Each raw message might contain several line in CSV format. If
the default header parameter is not set the codec trites the first line from the raw message as a header. Otherwise, the
default header will be used for decoding the rest of data. Output message type is taken
from `th2.csv.override_message_type` property in input message. If the property missing, the default
value (`Csv_Message`) for output message type is used.

If no data was decoded from raw message, the message will be skipped, and an error event will be reported.

**NOTE: the encoding is not supported**.

## Decode Example

Simple example:
Simple example:

```text
A, B, V, G
Expand Down Expand Up @@ -52,36 +53,46 @@ into
{
"A": 1,
"B": 2,
"V": [3, 4, 5],
"V": [
3,
4,
5
],
"G": 6,
"D": 7
}
```

## Settings

Csv codec has the following parameters:

```yaml
default-header: [A, B, C]
default-header: [ A, B, C ]
delimiter: ','
encoding: UTF-8
display-name: CodecCsv
validate-length: true
publish-header: false
trim-whitespace: true
```
**default-header** - the default header for this codec. It will be used if no header found in the received batch.
codec-csv trims all values in `default-header` and executes blank check.

**delimiter** - the delimiter to split values in received data. The default value is `,`.

**encoding** - the encoding for the received data. The default value is `UTF-8`.

**display-name** - the name to set in the root event sent to the event store. All errors during decoding will be attached to that root event.
The default value for the name is `CodecCsv`.
**display-name** - the name to set in the root event sent to the event store. All errors during decoding will be
attached to that root event. The default value for the name is `CodecCsv`.

**validate-length** - check if csv have different count of values against header's count.

**publish-header** - set to publish decoded header. The default value is `false`.

**trim-whitespace** - set to trim whitespace in header and cell. The default value is `true`.

## Full configuration example

```yaml
Expand All @@ -94,7 +105,7 @@ spec:
image-version: 4.0.0
custom-config:
codecSettings:
default-header: [A, B, C]
default-header: [ A, B, C ]
delimiter: ','
encoding: UTF-8
pins:
Expand All @@ -108,28 +119,59 @@ spec:
# decoder
- name: in_codec_decode
connection-type: mq
attributes: ['decoder_in', 'raw', 'subscribe']
attributes: [ 'decoder_in', 'raw', 'subscribe' ]
- name: out_codec_decode
connection-type: mq
attributes: ['decoder_out', 'parsed', 'publish']
attributes: [ 'decoder_out', 'parsed', 'publish' ]
# encoder general (technical)
- name: in_codec_general_encode
connection-type: mq
attributes: ['general_encoder_in', 'parsed', 'subscribe']
attributes: [ 'general_encoder_in', 'parsed', 'subscribe' ]
- name: out_codec_general_encode
connection-type: mq
attributes: ['general_encoder_out', 'raw', 'publish']
attributes: [ 'general_encoder_out', 'raw', 'publish' ]
# decoder general (technical)
- name: in_codec_general_decode
connection-type: mq
attributes: ['general_decoder_in', 'raw', 'subscribe']
attributes: [ 'general_decoder_in', 'raw', 'subscribe' ]
- name: out_codec_general_decode
connection-type: mq
attributes: ['general_decoder_out', 'parsed', 'publish']
attributes: [ 'general_decoder_out', 'parsed', 'publish' ]
```

## Release notes

### 5.3.0
+ Migrated to th2 gradle plugin: `0.0.6`
+ Updated:
+ bom `4.6.1`
+ common: `5.10.1-dev`
+ common-utils: `2.2.3-dev`
+ codec: `5.5.0-dev`

### 5.2.1

+ Updated common: `5.7.2-dev`
+ Updated codec: `5.4.1-dev`

### 5.2.0

+ Added `trim-whitespace` option.
+ Updated common:5.7.1-dev
+ Updated common-utils:2.2.2-dev
+ Updated codec:5.4.0-dev

### 5.1.0

+ Supports th2 transport protocol
+ Updated bom:4.4.0
+ Updated common:5.3.0
+ Updated codec:5.3.0

### 5.0.0

+ Migrated to books&pages concept

### 4.1.0

+ Migrated to `th2-codec:4.8.0`
Expand All @@ -143,8 +185,13 @@ spec:

### 4.0.0

+ Migration to **books/pages** cradle `4.0.0`
+ common updated from `3.13.1` to `4.0.0`
+ bom updated from `2.10.1` to `3.1.0`
+ bintray switched to **sonatype**

+ Migrated to `th2-codec` core part. Uses the standard configuration format and pins for th2-codec
+ Updated `bom`: `3.1.0` -> `4.1.0`
+ Updated `bom`: `3.1.0` -> `4.2.0`
+ Updated `common`: `3.37.1` -> `3.44.0`

### 3.2.1
Expand All @@ -160,7 +207,8 @@ spec:

+ reads dictionaries from the /var/th2/config/dictionary folder.
+ uses mq_router, grpc_router, cradle_manager optional JSON configs from the /var/th2/config folder
+ tries to load log4j.properties files from sources in order: '/var/th2/config', '/home/etc', configured path via cmd, default configuration
+ tries to load log4j.properties files from sources in order: '/var/th2/config', '/home/etc', configured path via cmd,
default configuration
+ update Cradle version. Introduce async API for storing events
+ removed gRPC event loop handling
+ fixed dictionary reading
Loading

0 comments on commit 7b29a44

Please sign in to comment.