App Connect

App Connect

Join this online user 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.  Accessing a user-defined policy from a JavaCompute node

    Posted Tue January 16, 2024 02:37 PM

    I am trying to acess user-defined policy from JCN... I am using ACE 12.0.9.0 on windows 11 laptop... as defined in this documentation - Accessing a user-defined policy from a JavaCompute node

    I have created Policy project Local and defined a sftpconn policy and deployed locally

    MbPolicy myPol = getPolicy("UserDefined", "{Local}:sftpconn");

    it is always comes back as null.

    Is there anything I am missing here.... 



    ------------------------------
    Kareem Qureshi
    ------------------------------


  • 2.  RE: Accessing a user-defined policy from a JavaCompute node

    Posted Wed January 17, 2024 04:07 AM

    Hello Kareem

    First: You will need to create the policy with the properties you need

    Second: You need to create a java class for the java compute node from which you want to access the policy.

    Third: Add user code to get the policy, which will be something like this: 

    • MbPolicy myUDPolicy = getPolicy("UserDefined", "{policyproject}:MyUDP"); which get a policy called MyUDP that is stored in "policyproject".

    Fourth: Add user code to access the policy to get the properties, which will be something like this:

    • System.out.println(" Name: "+myUDPolicy.getPropertyValueAsString("Name"));

    For more information refer to the IBM doc: https://www.ibm.com/docs/en/app-connect/12.0?topic=java-accessing-user-defined-policy-from-javacompute-node 

    Regards,

    Kjetil Svihus



    ------------------------------
    Kjetil Svihus
    ------------------------------



  • 3.  RE: Accessing a user-defined policy from a JavaCompute node

    Posted Wed January 17, 2024 04:11 AM

    Hello again!

    Sorry, I did not see the full message due to some issues with the site. But could you provide some more information about the policy, and where it is stored? Also share the class you have?

    Regards,

    Kjetil Svihus



    ------------------------------
    Kjetil Svihus
    ------------------------------