The transformers project provides serialization/deserialization support to the services. The following approaches are supported:
- Serialization/Deserialization support for an
BlobEvent. - Use of Fast Serialization library to implement FST based serialization/deserialization for ingestion data
- Below Transformers along with the capability of extending
Transformerto create a new transformer for event- Device Message Transformer - serialization to
byte[]from event - Generic Transformer - serialization/deserialization to/from
byte[]to generic event along with event attributes validation - Event data key transformer - serialization/deserialization to/from
byte[]to key
- Device Message Transformer - serialization to
- Support for adding object based serializers, deserializers and subtypes to the Jackson module's
ObjectMapper
- Getting Started
- Usage
- How to contribute
- Built with Dependencies
- Code of Conduct
- Authors
- Security Contact Information
- Support
- Troubleshooting
- License
- Announcements
To build the project in the local working directory after the project has been cloned/forked, run:
mvn clean install
from the command line interface.
- Maven
- Java 17
mvn test
Or run a specific test
mvn test -Dtest="TheFirstUnitTest"
To run a method from within a test
mvn test -Dtest="TheSecondUnitTest#whenTestCase2_thenPrintTest2_1"
Transformers project serves as a library for the services. It is not meant to be deployed as a service in any cloud environment.
Add the following dependency in the target project
<dependency>
<groupId>com.harman.ignite</groupId>
<artifactId>ignite-transformers</artifactId>
<version>3.X.X</version>
</dependency>
A custom transformer can be created for an IgniteEvent type by extending the Transformer contract.
Example:
public class GenericIgniteEventTransformer implements Transformer {
@Override
public IgniteEvent fromBlob(byte[] value, Optional<IgniteEventBase> header) {
// deserialization logic
}
@Override
public byte[] toBlob(IgniteEvent value) {
// serialization logic
}
}Services can provide custom serializers, deserializers, and subtypes to the Jackson's object mapper from the environment properties specified by the following:
#comma separated value for custom deserializer. className and it's deserializer needs to separated by :
#Example: k1:v1,k2:v2
custom.deserializers=com.harman.ignite.entities.EventData:com.harman.ignite.entities.EventDataDeSerializer
#Custom serializer in the form of k1:v1,k2:v2
custom.serializers=
#Custom subtypes in the form of k1:v1,k2:v2
custom.subtypes=The validation for a particular IgniteEvent attribute needs to be configured in the environment properties by the service.
NOTE: attribute name needs to be followed with 'inputValidation' prefix
Example:
EventID.inputvalidation=ALPHA
BizTransactionId.inputvalidation=ALPHA_NUMERIC
Timestamp.inputvalidation=NUMERIC|13
DFFQualifier.inputvalidation=ALPHA
CorrelationId.inputvalidation=NUMERIC
MessageId.inputvalidation=NUMERIC|6
RequestId.inputvalidation=ALPHA_NUMERIC|-
SourceDeviceId.inputvalidation=ALPHA_NUMERIC
VehicleId.inputvalidation=ALPHA_NUMERIC| Dependency | Purpose |
|---|---|
| Ignite Utils | Logging Support |
| Spring Framework | For writing tests |
| Maven | Dependency Management |
| Junit | Testing framework |
| Mockito | Test Mocking framework |
| Power Mock | Test Mocking framework with extra mocking features |
| Fast Serialization | FST serialization support |
Please read CONTRIBUTING.md for details on our contribution guidelines, and the process for submitting pull requests to us.
Please read CODE_OF_CONDUCT.md for details on our code of conduct.
- Kaushal Arora - Initial work
- Ashish Kumar Singh - Coding guidelines
See also the list of contributors who participated in this project.
Please read SECURITY.md to raise any security related issues.
Contact the project developers via the project's "dev" list - https://accounts.eclipse.org/mailing-list/ecsp-dev
Please read CONTRIBUTING.md for details on how to raise an issue and submit a pull request to us.
This project is licensed under the XXX License - see the LICENSE.md file for details.
All updates to this library are documented in our Release Notes and releases. For the versions available, see the tags on this repository.
[sonar img]:
[coverage img]:
