MarkLogic : DHF 4.0.0 Load Custom REST modules

106 Views Asked by At

We are using version 9.0.6 and DHF 4.0.0

I have a custom REST module in my data hub repository at ..\src\main\ml-modules\services\customModule.sjs

When I run 'gradle mlLoadmodules' the build is successful but the module (/marklogic.rest.resource/RegsiteredCustomer-Preferences/assets/resource.xqy) is not loaded to data-hub-MODULES or data-hub-final-MODULES DBs. I removed timestamp property (rm .tmp/user-modules-deploy-timestamps.properties) and re-ran the mlLodModules command but still the same issue.

I intend to call this custom module through port 8011 (GET http://localhost:8011/v1/resources/customModule), so where is this module supposed to be loaded? data-hub-MODULES or data-hub-final-MODULES? In prior versions of DHF, I noticed that this gets loaded to data-hub-MODULES.

Also, any hints on why the module is not getting loaded, are appreciated.

1

There are 1 best solutions below

0
On

Take a look at http://localhost/v1/config/resources and http://localhost:8010/v1/config/resources. One or both of those ought to be showing your extension. If it doesn't show up there, it didn't get deployed.

Assuming it's not being deployed, the next question is "why not?" The most likely reasons are that ml-gradle thinks it doesn't need to be deployed or that there's an error in validation.

You can rule out the first one by running "gradle mlReloadModules" instead of "gradle mlLoadModules". That command will clear out the relevant modules database, then load everything.

When you load a REST extension, MarkLogic validates its syntax and the syntax of any library modules that it depends on. If there are any validation errors, they will show up when you try to load.