2

I don't want to pass credentials directly in dblookup or dbreport mediators,instead that I want to take the credentials from regsitry file in MI.

Note : With the help of datasource I achieved it but I am trying with registry file.

Can someone please guide me to proceed further?

In ESB & EI, from management console we can create registry file & then we can take the values in synapse.

But in MI,I don't know how to create registry file, If I create manually under conf or repository folder also couldn't take throwing null pointer exception only.

I created a file under local-entries, I took those values using OM in proxy and assigned it in property but in dblookup configuration how to pass those values?

local-entry

Proxy

Exception

Sumathi M
  • 33
  • 4
  • Please do not post images of the errors and source code when asking questions. Please make sure to update the question with the source and errors with proper formatting. – ycr Feb 24 '23 at 15:00

2 Answers2

0

In Micro-integrator, working with Registry is done using Integration Studio. Use the Integration Project in the Integration Studio, and then you can manipulate the Registry Resounrecs.

Please check this - https://apim.docs.wso2.com/en/latest/integrate/develop/creating-artifacts/data-services/securing-data-services/#step-1-creating-a-registry-resource-module

Joy Rathnayake
  • 485
  • 4
  • 8
  • Thanks. I will follow this guide but my doubt, is this possible to pass property in connection pool instead of values? – Sumathi M Feb 23 '23 at 14:52
0

The old DB-backed registry implementation which was in EI/ESB was removed in Micro Integrator. Micro Integrator has a new file system-based registry implementation, this registry is local to the server itself. So what you are trying to do will not work with Micro Integrato as it's not shared across instances by default.

Having said that, the registry entries are created in <MI_HOME>/registry directory which maintains the same registry hierarchy in a folder structure. For example, if you create a registry resource in the path /_system/governance/endpoints/something it would be created like this in the file system, <MI_HOME>/registry/governance/endpoints/something. Hence you can manually create the file in the registry directory and see whether it works.

On a different note, the proper way to create Registry Resources is through the Integration Studio with a registry resource project. Take a look at this document.

Update

You can't have an XML structure in the registry resource and do XPATH expression on that. This is where the registry entry is retrieved and I don't see support for any XPATH evaluations. It just searches the entry with the key. So create a text file for each entry with just the value and upload it as a registry resource to the Registry Project. Also in the artifact.xml of the registry project make sure you don't have a MediaType set for the uploaded artifact.

<artifact name="db_user" groupId="com.example.resource" version="1.0.0" type="registry/resource" serverRole="EnterpriseIntegrator">
        <item>
            <file>db_user</file>
            <path>/_system/config/custom</path>
            <mediaType/>
            <properties/>
        </item>
    </artifact>

In the DBlookup refer it like below.

<user key="conf:custom/db_user"/>
ycr
  • 12,828
  • 2
  • 25
  • 45
  • I have created a crdentials file under registry through the studio, but still I am facing null pointer exception only. Please refer connection pool configuration in below document (https://ei.docs.wso2.com/en/latest/micro-integrator/references/mediators/dBLookup-Mediator/) Please guide me how they are taking values – Sumathi M Feb 24 '23 at 06:56
  • @SumathiM take a look at the updated answer. – ycr Feb 28 '23 at 01:09
  • I have tried but still I am facing Null pointer exception only, I don't know what am I doing wrong? – Sumathi M Feb 28 '23 at 08:57
  • @SumathiM did you follow the exact steps? Can you share your artifacts? – ycr Feb 28 '23 at 13:35