kpavlov / jreactive-8583

Kotlin/Java Client & Server for ISO8583 & Netty
Apache License 2.0
317 stars 141 forks source link

Echo message type 0x1800 instead of expected 0x1804 #143

Closed msche closed 2 years ago

msche commented 2 years ago

I have just started using your library and opened a connection as described in the documentation. After a while, the IdleEventHandler kicks in and starts generating echo messages to the acquirer. I was expecting it would create ISO 8583 messages of type 0x1804 (which is expected by our acquirer) but instead it creates messages of type 0x1800. I was wondering what I have done wrong of forgot to configure.

kpavlov commented 2 years ago

Hi, Mark (@msche) this is because IdleEventHandler is assuming that he is the ACQUIRER:

private fun createEchoMessage(): IsoMessage {
        return isoMessageFactory.newMessage(
            MessageClass.NETWORK_MANAGEMENT, // messageClass
            MessageFunction.REQUEST, // messageFunction
            MessageOrigin.ACQUIRER // messageOrigin
        )
    }

So, it should be parameterized. Meanwhile, you can replace it with your custom handler in the ConnectorConfigurer.configurePipeline:

pipeline.replace("idleEventHandler", "idleEventHandler", MyIdleEventHandler(isoMessageFactory))
kpavlov commented 2 years ago

The fix is: Parametrise J8583MessageFactory with desired party role (i.e. MessageOrigin):

new J8583MessageFactory<>(messageFactory, ISO8583Version.V1987, MessageOrigin.OTHER)
msche commented 2 years ago

Thanks for the quick response..