2

I am picking up a file from a folder specified using Camel File Component and mlcp automatically injects the filename to the default URI and i dont want the filename

When i put the file in D:/Camel with file named test_1.xml mlcp produces a URI

/D:/Camel/test_1.xml

. I want /D:/Camel/test_1.xml to be replaced with '/Vikram' and i want to inject a header from camel to MLCP component too making the final URI be

/Vikram/1

where 1 will be the header value of myHeader

 from("file://D:/Camel")
    .routeId("File_Pickup_Route")
    .setHeader("myHeader")
    .to("mlcp:localhost:8000?username=admin&password=admin&output_collections=test
      + "&database=testdb"
      + "&output_uri_replace=/D:/Camel,"
      + "'/Vikram'");

I referred the link

https://docs.marklogic.com/guide/mlcp/export#id_67189

Any way to achieve what i want ? Thanks in advance

Rob
  • 14,746
  • 28
  • 47
  • 65
Vikram
  • 635
  • 1
  • 9
  • 29

1 Answers1

1

I believe you need to put the strings into double quotes:

-output_uri_replace "/uriToReplace,'final-uri'"

Therefore (without knowing much about the syntax of camel):

from("file://D:/Camel")
    .routeId("File_Pickup_Route")
    .setHeader("myHeader")
    .to("mlcp:localhost:8000?username=admin&password=admin&output_collections=test
      + "&database=testdb"
      + "&output_uri_replace="/D:/Camel,'/Vikram'");

(I have changed the last line).

Give this a go and let me know if it worked or not.

For more information please read: https://docs.marklogic.com/guide/mlcp/import#id_42798

Tamas
  • 10,953
  • 13
  • 47
  • 77
  • Hi Tamas thanks for the answer. The problem is am able to replace the folderpath but not the filename as i described in my question. you are just replacing the folder path. I want /D:/Camel/test_1.xml to be replaced with '/Vikram' but the output am getting is '/Vikram/test_1.xml' from what you suggested – Vikram Oct 16 '17 at 09:06
  • &output_uri_replace="/D:/Camel/${file:name},'/Vikram'"); but am not able resolve $ symbol. i dont know how to replace filenames inside mlcp if anything is available... Thanks in advance – Vikram Oct 16 '17 at 09:32