Solved

How do I get FME Server to use "DataStreaming" instead "DataDownload" when sending response to Javascript (FMEerver.js) request?

  • 6 October 2021
  • 2 replies
  • 10 views

Badge

It's quite possible I'm missing something rather obvious here. But I can't figure it out. Funny how when searching the web what I stumble upon is my own post from a year ago.

 

What I have put together since is a workspace that reads CSV and spits out JSON. I've published this to FME Server (2020.2) and selected "Data Streaming" and "Job Submitter" as services.

 

Now, I'm sending a CSV file from a web page to FME Server using some of the examples here, and effectively calling the workspace with a Javascript line like this:

FMEServer.runWorkspaceWithData( repository, workspace, params, callbackFunction);

This works great but all I've been able to do is hit the Download Service, so the service response contains a URL for a zip file. How do I switch this to Data Streaming ? I guess this might also turn this into a asynchronous? If so, is "runWorkspaceWithData" still the right way to do this?

Currently my params look like this:

var params = {
filename : fileObj.name,
files : [fileObj],
params : [],

I've seen some example that contained a property "service" in the params. Is that a way to select "Data Streaming".

 

Sorry, the FME Javascript pages were a great help until I got to this point. Any feedback is appreciated.

 

icon

Best answer by david_r 7 October 2021, 09:40

View original

2 replies

Userlevel 4

The different services are referenced by using different service endpoints.

Try setting params.service to 'fmedatastreaming'. If the value is not specified, as in the example above, it defaults to 'fmedatadownload'.

Example:

var params = {
     filename : fileObj.name,
     files : [fileObj],
     params: [],
     service: 'fmedatastreaming'
    }

You can also look at the full source code for FMEServer.js here: http://api.fmeserver.com/js/v3/FMEServer.js

Badge

@david_r​  - that's perfect, thank you. I had tried the 'service' parameter earlier (see my post) but I was using the wrong keyword. So 'fmedatastreaming' fixed it. Works like charm now. Gonna be a good day today! 😁

Reply