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
Related Q & A:
- How To Convert Pmd File To Pdf File Online?Best solution by Yahoo! Answers
- How convert .txt file to .Dat file in php?Best solution by Stack Overflow
- How to create an inclusive aar file in Android?Best solution by Stack Overflow
- How to convert a HTML file to XML file?Best solution by Stack Overflow
- How can I attach more than one file at a time in Yahoo mail?Best solution by pc.net
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.