go to post Eduard Lebedyuk · Mar 16, 2021 How about a slightly different architecture: Create a table, visible in all namespaces called Requests - and from Data Source namespace add 1 row to it on every new message. Create a table, visible in all namespaces called Ack which contains {RequestId, Namespace, State} In each namespace create a Business Service which would: Poll Requests/Ack tables to get new unprocessed requests (no corresponding Ack record). If an unprocessed request is found create an Ack record and send a message in a local namespace for BP processing Maybe write a response after the message is processed (or do it in BP/ProxyBP/job) Advantage of this architecture is that you decouple processing on a namespace level - so if a production in one namespace is in error state/down the rest can proceed. It also eliminates a single point of failure in namespace switching job. tl;dr instead of pushing your event make consumers pull it whenever convenient.
go to post Eduard Lebedyuk · Mar 16, 2021 Supply them in $horolog format. In a case of YYYY-MM-DD, try: $zdateh("YYYY-MM-DD", 3)
go to post Eduard Lebedyuk · Mar 15, 2021 You can also just call: set jsoninput = {}.%FromJSON(dir) where dir is a filename.
go to post Eduard Lebedyuk · Mar 15, 2021 Use any of the Binary streams: %Stream.FileBinary - If you store files on disk %Stream.GlobalBinary - if you store files in globals To send a stream just fill EntityBody property of a request object by calling it's CopyFrom method.
go to post Eduard Lebedyuk · Mar 15, 2021 Interoperability (ex. Ensemble) can be used to both import data into InterSystems Data Platforms and push it to external systems.
go to post Eduard Lebedyuk · Mar 15, 2021 OnHandleCorsRequest is called automatically if a browser requests CORS. To add to original answer a bit: Do %response.SetHeader("Access-Control-Allow-Origin","*") This is OK for development but for production use you need to replace * with a hostname of your web site.
go to post Eduard Lebedyuk · Mar 10, 2021 Check this article. You'll need either HTTP Debugging proxy or Packet analyzer to debug this.
go to post Eduard Lebedyuk · Mar 9, 2021 You probably have a mismatched brackets somewhere. You can also try [].%FromJSON instead of {}.%FromJSON
go to post Eduard Lebedyuk · Mar 9, 2021 Your code has a bracket at the end: You might have erased it accidentally?
go to post Eduard Lebedyuk · Mar 9, 2021 If you're sure that there's only one object in response array, replace: Set tSC = pResponse.%JSONImport(tHttpResponse.Data.Read()) with: Set tSC = pResponse.%JSONImport({}.%FromJSON(tHttpResponse.Data).%Get(0)) It would parse your JSON stream into a dynamic JSON array (via {}.%FromJSON(tHttpResponse.Data)), get zeroth element from it (via %Get(0)), and pass it for JSON import (via pResponse.%JSONImport).
go to post Eduard Lebedyuk · Mar 9, 2021 If you're sure that there's only one object in response, replace: Set tSC = pResponse.%JSONImport(tHttpResponse.Data.Read()) with: Set tSC = pResponse.%JSONImport({}.%FromJSON(tHttpResponse.Data).%Get(0)) If you want to parse an entire array, you'll need another class: Class CDSM.ProviderAPI.Responses Extends (%Persistent, %JSON.Adaptor) { Property Responses As List Of CDSM.ProviderAPI.ProviderInfo; } And in this case replace this code: Set pResponse=##class(CDSM.ProviderAPI.Response).%New() Set tSC = pResponse.%JSONImport(tHttpResponse.Data.Read()) With: Set pResponse=##class(CDSM.ProviderAPI.Responses).%New() Set tSC = pResponse.%JSONImport(tHttpResponse.Data) and update the method signature too.
go to post Eduard Lebedyuk · Mar 9, 2021 Why would be better or recommended to use %CSP.REST directly, instead of EnsLib.REST.Service? To start with using %CSP.REST is the recommended way to use REST with productions. Are there any improvements if we use %CSP.REST? It's easier to develop, there are more examples available, you can have a combined production/non-production REST services easily.
go to post Eduard Lebedyuk · Mar 9, 2021 The first, but not the last one, so still not getting the idea of having this intermediate upgrade point. Sure, but you can start freezing on 2016.2. There's no point in freezing if you jump to latest version from pre 2016.2 Sorry, on which topic? Everyone knows that Cache/IRIS never runs on an unsupported OS. Upgrade path between Cache/IRIS versions where OS for old and new Cache/IRIS versions must be different.
go to post Eduard Lebedyuk · Mar 8, 2021 Yes, check my other reply, I get the zeroth element from the JSON array with %Get(0). Also both [] and {} are valid JSON.
go to post Eduard Lebedyuk · Mar 8, 2021 Check out GetStored and other useful auto-generated methods in this article.
go to post Eduard Lebedyuk · Mar 8, 2021 I would recommend using plain %CSP.REST and calling BP/BO from it. Here's how. You'll need to replace async call with a sync one to get response back, but the rest of the logic would be the same.