How do you parse a time variable from database?

Parse and create message from config file/database/property file at run time

  • In my application perticular message structure/format are send and received. When I have to send the message, the message should be created on the particular format. I have parse message on perticular message. The message nothing but byte array To parse the message I have used Preon lib. I have following problem with : Programatically I have to create the byte array for each field. When message format get changed I have to change the code. How can I construct run time message structure and parse the message structure. The message structure look like this Message1{ int field_1 char[2] field_2 long filed_3 double filed_4 bit field_5 short field_6 char field_7 } Message2{ Message1 msg short field_8 char field_9 } Message structure will be change any time. There are more than 1000 types of messages in the system. So I am looking for solution in java which will create message and parse from given structure runtime. If you have sample code, please provide the code sniipet.

  • Answer:

    I would use an OSGi container (karaf/iPOJO) which allows me to change the code while the application is running. This means you can add fields, change their type and size while the system without bringing down the application. Note: if you add a field or make a field larger but the code doesn't support it won't you lose information?

Kamahire at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.