IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Make enum values configurable

  • 1.  Make enum values configurable

    Posted Thu November 22, 2018 02:54 AM

    Hi All,

    Current scenario- I have one schema ( generated from xsd) and one document ( generated from schema).I am validating this document at run time (Schema:validate service).

    Problem- In my schema there is one enum filed ( suppose city) and I have already define some values for this field, but the issue is when new value came, I need to change the schema which is kind of a code change.

    Is there any way to make this enum value configurable without changing in schema (like reading from file , db etc.) ? if yes , then how can I achieve this?

    Thank you in advance.


    #webMethods-Architecture
    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 2.  RE: Make enum values configurable

    Posted Thu November 22, 2018 03:14 AM

    What I think to change enum field to normal string and read values from config file.
    in flow service , I can compare the values.

    Is this approach is good or is there any other way?


    #webMethods-Architecture
    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 3.  RE: Make enum values configurable

    Posted Thu November 22, 2018 01:44 PM

    Hi Mohit,

    using a config file might be the option you want to look for.

    Just have one property (=key) in it and put the values to value part of the property.
    Just use a semicolon as a separator between the different values and then use tokenize to split the values string into a list of strings.
    You can the compare the data against this list.

    If you have a database available you can create a table containing the allowed values and then do select with JDBC Adapter service to check if the value can be found (row count=0: missing; row count>1: configured).

    Schema node and derived document types need to be regenerated when xsd changes.

    Regards,
    Holger


    #webMethods-Architecture
    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods


  • 4.  RE: Make enum values configurable

    Posted Fri November 23, 2018 03:00 AM

    Thank you so much Holger for you reply.

    Is there any other way/approach to achieve this?

    Regards,
    Mohit


    #webMethods-Architecture
    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General


  • 5.  RE: Make enum values configurable

    Posted Sat November 24, 2018 05:29 AM

    I am not sure how is your xml schemas are managed and who owns it. From your information I would suggest you to have a blend of both database and cache (ehcache/terracotta) to hold your enum values.

    The design approach is database will hold the source of truth and you will load the cache from the db so that the enum values will be retrieved from the cache and as a fallback you can retrieve from the db.

    Hope it is clear if not get back to me.


    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB
    #webMethods-Architecture


  • 6.  RE: Make enum values configurable

    Posted Wed November 28, 2018 03:05 AM

    Thank you Mahesh for your reply.
    Correct me if I am wrong.

    I have to check for max 6 values. If I used DB then I have to make additional call to DB rather than this i think reading from properties file be more fast.


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods
    #webMethods-Architecture


  • 7.  RE: Make enum values configurable

    Posted Wed November 28, 2018 04:10 AM

    For your use-case, I would recommend DB with Service Caching where you can cache the results of select adapter service. This approach will hit DB once and stores the values in the cache, further executions will not hit db and it will be retrieved from the service cache.

    Refer “About Service Caching” from Service Development Help guide.

    More questions?


    #webMethods-Architecture
    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods


  • 8.  RE: Make enum values configurable

    Posted Wed November 28, 2018 04:52 AM

    yes this make sense.

    Thank you Mahesh for your help.


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-Architecture
    #webMethods-General


  • 9.  RE: Make enum values configurable

    Posted Thu December 06, 2018 02:05 AM

    Hi All,

    Current scenario- XML data comes to IS then transform to document and validate with the schema( generated from xsd using pub:schema:validate service).

    Ques- We have xsd placed at one place ( file system) and when the xml data comes to IS, we want to validate that data with xml string coming as input.
    Motive behind do this, If we want to add any enum value in xsd then it can be validate at first level ( no need to change in code).
    Is there any way to achieve this?

    note- document is not generated with schema. it is a flat document which used for mapping only.

    Thanks in advance.


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods-Architecture