Add support for string encoded frame length header #84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello @kpavlov and other contributors,
first, let me thank you for this library. I just started using it and it looks like it's going to help me save a lot of time.
Now, to the issue I had - I'm integrating with a vendor which doesn't use a binary frame length header, but a 4 byte, zero padded, ASCII encoded one. For example, an ISO message of length 93 would have the length header of
0093
.Since the first stage in the ChannelPipeline is Netty's
LengthFieldBasedFrameDecoder
and it expects a binary length header, I needed to extend it and override it'sgetUnadjustedFrameLength
method in StringLengthFieldBasedFrameDecoder.Then, I did some config plumbing in
ConnectorConfiguration
which is used inIso8583Encoder
andIso8583ChannelInitializer
.Currently, US_ASCII is hardcoded when encoding and decoding, but I'd be willing to make that configurable if it's a realistic use case, which I'm not aware of.
Usage example for the new configuration:
Existing tests are passing, but I haven't added new tests, only tested it manually. I will add tests if this PR has a chance of being accepted. I'd be glad to discuss it and take suggestions.
Cheers,
Bojan