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
  • 1.  use object of a custom class across multiple CAF Packages

    Posted Thu May 05, 2011 03:32 PM

    hi All,

    Could you please suggest if there is any way to achieve following functinality:

    Funtionality: Re use an object of custom defined class across multiple CAF projects.

    More description: I have defined a custom class in one of my CAF projects. At runtime, I want to put this object into session and want to utilize this object in
    another page bean which is defined in another CAF project.

    For example:
    I defined an objecet for class Map and put into session from one of my CAF projects at runtime and the same Map obect can be retrieved from session
    and the contents of this Map object can be used in a potlet which is defined in another CAF project.

    I am looking for a solution to use an object of a custom defined Class in the same way as I use Map object above.

    Kind regards,
    Raja sekhar Kintali


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 2.  RE: use object of a custom class across multiple CAF Packages

    Posted Mon May 09, 2011 10:51 PM

    I’ve attached a sample consisting of three simple projects.

    The general concept is:

    • Use a shared library that is in the MWS class path
    • Each Web Application accesses the MWS specific Context object for sharing session data

    The first project is a simple Java Project called: SharedObjectProject. This will be the ‘library’ that contains your custom class. In order to use this at design time, you should modify the build properties of other projects to reference this project.

    At runtime, in order of the other web applications to use the classes exposed in the library, you’ll need to:

    • build a jar file
    • copy it in the MWS/updates folder
    • run mws.bat|sh update in order to add it to the MWS classpath

    The other two projects are identical just to prove that they have access to the same object shared over the user’s MWS session.

    The key to each portlet is how it accesses the shared instance of the object:

    	public MySampleData getSampleData() throws Exception {
    if (sampleData == null) {
    //get MWS session
    IContext context = ContextFactory.acquireContext(false);
    if (context == null) {
    throw new Exception("Unable to find context");
    }
    //get the object from the session if it exists
    sampleData = (MySampleData)context.getAttribute("sampleData", IContext.SCOPE_SESSION);
    if (sampleData == null) {
    sampleData = new MySampleData();
    //write back to the session
    context.setAttribute("sampleData", sampleData, IContext.SCOPE_SESSION);
    }
    }
    
    //not totally necessary, just boilerplate code
    resolveDataBinding(SAMPLEDATA_PROPERTY_BINDINGS, sampleData, "sampleData", false, false);
    return sampleData;
    }

    SharedObjectWebAppTwo.zip (19.6 KB)


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 3.  RE: use object of a custom class across multiple CAF Packages

    Posted Fri May 13, 2011 01:11 PM

    hi Mark,

    Thank you for your response with sample projects and detailed explanation.

    Tried in our envrionment where only 1 MWS node is present. It is working as expected.

    1. Could you please suggest it’s behavior in Cluster environment where more than 2 MWS nodes are present?

    (sorry for asking this question - instead of checking at my end in cluster environment, but I couldn’t check this fix in cluster environment because of some other complexities).

    1. Could you also suggest the procedure to remove this jar file from classpath?

    Kind regards,
    Raja sekhar Kintali


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 4.  RE: use object of a custom class across multiple CAF Packages

    Posted Mon May 16, 2011 08:41 PM
    1. Regarding a cluster environment. This means that you are looking to use a distributed cache. That’s not a current feature of MWS. You’ll have to use your own tools. You might look at many of the quality open source caches like memcache.

    2. To remove a jar from the classpath (that you had in the updates folder), just re-run mws.sh|bat update.

    Regards,
    –mark


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 5.  RE: use object of a custom class across multiple CAF Packages

    Posted Tue May 17, 2011 01:47 PM

    hi Mark,

    If the session is ‘sticky bit session’ in Cluster environment, then user will be sticked to only 1 MWS node all along his session duration.

    In this case, even in cluster envrionment, I think we can share an object for a custom class across multiple CAF pacakages, in session during run time.

    may I know your comments?

    Kind regards,
    Raja sekhar Kintali


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 6.  RE: use object of a custom class across multiple CAF Packages

    Posted Tue May 17, 2011 07:50 PM

    The data should be available as long as the session is active and only on the VM that the data was created/stored.


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 7.  RE: use object of a custom class across multiple CAF Packages

    Posted Mon July 18, 2016 02:04 AM

    Hi Guys,

    Is this feature (shared custom library in cluster environment) available in webMethods 9.8 suite?

    Kind regards,
    Raj


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS