Lua protobuf. pb package sends wrong encoded message if this message is empty - lua

I've got a problem with using lua pb package.
pb.encode function encodes protobuf message in a wrong way if this message is described so:
message MyMessage
{
}
When I got the encoding message on server it differs from one that has at least one field.
What's wrong with pb ? Thanks

Related

How do I solve the "attempt to call a table value" runtime error on lua?

I'm working on a lua script to convert IO Link data into MQTT. When I debugged the script, I got following runtime error on the function client:register :
Runtime error: attempt to call a table value (global 'string')
I understood that out of the 3 parameters needed, the eventname has to be in string. Coming from Java, I tried converting it directly in the function. It looks like this:
client:register( deviceHandle, string(IOhandleOnDisconnected) , IOhandleOnDisconnected )
It still does not work though.
Does anybody have an idea how to fix this?
Greetings.
string is Lua's standard library for string manipulation. It is a Lua table which cannot be called as you did in string(IOhandleOnDisconnected)

Error when use kafka-avro-console-consumer consume avro message sent by spring cloud stream kafka

I tried official schema-registry-confluent example (consumer/producer) with my local installed confluent 4.0.0, it can send "sensor" avro message when send post request and receive in listener, but when I use kafka-avro-console-consumer tool shipped with confluent 4.0.0 to view avro message sent, the tool raised the following error (a). I also tried to consume avro message sent by kafka-avro-console-producer tool (and the message can be shown correctly in kafka-avro-console-consumer tool) , it reported the following error (b). Doesn't the given example support confluent 4.0.0? Many thanks!
(a) kafka-avro-console-consumer error =>
ERROR Unknown error when running consumer: (kafka.tools.ConsoleConsumer$:107)
org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id -1
Caused by: org.apache.kafka.common.errors.SerializationException: Unknown magic byte!
(b) listener error =>
org.springframework.messaging.converter.MessageConversionException: Could not read JSON: Invalid UTF-32 character 0x51473863 (above 0x0010ffff) at char #1, byte #7); nested exception is java.io.CharConversionException: Invalid UTF-32 character 0x51473863 (above 0x0010ffff) at char #1, byte #7)
at org.springframework.messaging.converter.MappingJackson2MessageConverter.convertFromInternal(MappingJackson2MessageConverter.java:234) ~[spring-messaging-5.1.0.BUILD-SNAPSHOT.jar!/:5.1.0.BUILD-SNAPSHOT]
Every time there is a MessageConversionException it simply means that the provided Message Converters could not convert Message. . . and rightfully so as we can't handle every scenario, only the common ones.
So, you should implement custom Message Converter (either from scratch or extending one of the existing ones).
Here is more info on how to define custom Message Converter
https://docs.spring.io/spring-cloud-stream/docs/Fishtown.M1/reference/htmlsingle/#spring-cloud-stream-overview-user-defined-message-converters

Unable to Parse NTE if the segment order is changed

I got a HL7 message with NTE segment. The HL7 message type RDE_O11 and version 2.5. While passing message with NTE, NHAPI is not parsing it. So with the following message,
MSH|^~\&|xxxx|xxxx|||||RDE^O11^RDE_O11||P|2.5||||||ASCII|||
PID||||||||||||N|||||||||
PV1|||||||||
ORC|||||||
RXO||||||||||||||||||||||||||
RXR||||||
RXE|||||M
NTE|1||#2 from 10/19/15 amb|RE
TQ1||
TQ1|||PO Q6H PRN|A||
RXR||||||
If I change the position of NTE right after MSH, NHAPI is able to parse it.
MSH|^~\&|xxxx|xxxx|||||RDE^O11^RDE_O11||P|2.5||||||ASCII|||
NTE|1||#2 from 10/19/15 amb|RE
PID||||||||||||N|||||||||
PV1|||||||||
ORC|||||||
RXO||||||||||||||||||||||||||
RXR||||||
RXE|||||M
TQ1||
TQ1|||PO Q6H PRN|A||
RXR||||||
What kind of error are you getting? The HL7 specification for the RDE_O11 message structure does allow NTE segments to appear after RXE (among several other locations). So it ought to work.

quickfix/j NewOrderMultileg message get truncated

In my application, I am receiving a NewOrderMultiLeg message. The entire message is logged into the 'messages.log' file. But when I recevie the message into the onMessage(Message message, SessionID sessionID) method, I am getting only a part of the message, the message is getting truncated. i.e I only one element from the repeated group and the rest of the messages are truncated. I pasted here the message I recevied in log file and method.
Please help me to sort out this issue.
Message from application debugger.
8=FIX.4.49=10935=AB34=749=Server52=20150525-07:10:47.05956=TRADERINFO1=0.011=1250000163=1110=0228=0555=3635=0.010=075
Message from FIX logger.
8=FIX.4.49=24735=AB49=Server56=XXXXXXX34=452=20150525-07:08:14.71111=125000011=0.063=1635=0.0110=0228=0555=3616=9623=1687=10565=1616=3623=1687=10565=1616=13623=1687=10565=160=20150525-07:08:09.874152=1040=2376=XXXXXXXSERVER835=310=229
I am using FIX 4.4, quickfixj1.5.3.
Part of my config file
RejectInvalidMessage=N
ValidateFieldsHaveValues=N
ValidateIncomingMessage=N
ValidateFieldsOutOfOrder=N
ValidateUserDefinedFields=N
DefaultApplVerID=FIX.4.4
UseDataDictionary=Y
Thanks in advance.
Thanks
Bibin
I was missing one mandatory field 'LegSymbol' in InstrumentLeg component. In QuickFIX/J FIX4.4 dictionary shows 'LegSymbol' is non mandatory field but I found from some other sources, it is a mandatory field. Once I started receving the message with 'LegSymbol' field, my issues got sorted out.
Thanks
Bibin

HL7 parser to parse v2.7 messages in java

I'm looking for a HL7 parser that would parse v2.7 messages. I have tried Hapi but it has support only upto v2.6.
Can you anyone please provide any suggestions in parsing v2.7 messages?
Additionally to allowing unknown versions (like nradov pointed out), you need to inject the right model class factory, e.g. GenericModelClassFactory, into the parser or you might end up with an exception:
ca.uhn.hl7v2.HL7Exception: No map found for version null. Only the following are available: [V22, V25, V21, V23, V24]
So the complete solution is
use the GenericModelClassFactory
allow unknown versions
and it looks like this:
final ModelClassFactory modelClassFactory = new GenericModelClassFactory();
final PipeParser parser = new PipeParser(modelClassFactory);
parser.getParserConfiguration()
.setAllowUnknownVersions(true);
final Message message = parser.parse(message);
Like nradov said, you can use HAPI to parse V2.7. But you'll need to call this to prevent the "2.7 is not recognized" Exception:
parser.getParserConfiguration().setAllowUnknownVersions(true);
You can still use HAPI to parse HL7 V2.7. It just doesn't have convenient methods to easily access the new fields that were added after V2.6.

Resources