Eduard Lebedyuk · Apr 16, 2021 go to post

Generalize.

1. You can have 1 BP/1 BO called GET resource which gets:

  • resource id
  • resource type

And based on that information constructs the required JSON.

2. If BP only proxies requests to BO you can skip BP and call BO straight from BS.

Check out RESTForms2 - it does something similar (CRUD over classes) and there's only 4 handlers for all classes. 

Eduard Lebedyuk · Apr 12, 2021 go to post

While I do agree, what's the use case?

If you're requesting objects en masse it's usually via sql and it's easy to provide id there.

In a case of a singular object you usually request it by ID so it's known beforehand.

Eduard Lebedyuk · Apr 11, 2021 go to post

Interesting question! Here are my findings for store/intersystems/irishealth-community:2020.4.0.524.0 and a simple app in the USER namespace.

Uncompressed (Mb) Compressed (Mb)
IRIS 3 323 897
IRIS Squashed 3 293 893
App 8 436 1 953
App MSB 3 526 937
App Squashed 3 576 931
App MSB + Squashed 3 363 904

Notes:

  • MSB means Multi Stage Build
  • Squashed means that an image was built with a --squash option
  • Uncompressed size is calculated via docker inspect -f "{{ .Size }}" $image
  • Compressed size is calculated via (docker manifest inspect $image | ConvertFrom-Json).layers | Measure-Object -Property size -Sum
  • More info on calculating image sizes is available here

Conclusion: either MSB or Squashed work fine, but just MSB would be better for storage as it can have shared layers (squash always produces one unique layer). Squashed is easier to implement.

Eduard Lebedyuk · Apr 9, 2021 go to post

The best place to do that is your REST broker.

After you got your error from BP, just create your own error and pass that.

Eduard Lebedyuk · Apr 3, 2021 go to post

Thank you!

Why do you map %ZLANGC00/%ZLANGF00 to %ALL? They are available everywhere by default.

Eduard Lebedyuk · Apr 1, 2021 go to post

Separate REST logic form a business logic and call ObjectScript method directly?

Check out this article on REST design (esp. terminal layer in the article terms).

Eduard Lebedyuk · Mar 22, 2021 go to post

It's not a server who checks for expiry, but a client. So your flow works like this:

1. 15:00 calling application runs a GET request for patient?MRN=A
2. 15:00 CSP Web application calls HIHLib.REST.Server class and forwards request on to namespace for handling (via business services,process and operations)
3. 15:00:05 response is returned with EXPIRES 300 and VaryByParam set to *
4. 15:10 a seperate internall process results in patient with MRN A - first name changed from pete to bob
5. 15:12 calling application runs a GET request for patient?MRN=A
6. 15:12 web browser (on a client side) sees that patient?MRN=A request is cached locally and still valid due to EXPIRES 300. Web browser is returning a cached value to a calling application without going to the server.

And server would never get a second request (that's the point of the EXPIRING header after all).

Expires controls how long the response is valid. It's for things like HTML pages which are static.

If you think that a response can change every time a client requests it, you should not add an EXPIRING header.

Eduard Lebedyuk · Mar 17, 2021 go to post

If you want to know if a compiled class exists, call:

write $$$comClassDefined(class)

It, however, does not answer the question of a compiled version being current.

Eduard Lebedyuk · Mar 16, 2021 go to post

How about a slightly different architecture:

  1. Create a table, visible in all namespaces called Requests - and from Data Source namespace add 1 row to it on every new message.
  2. Create a table, visible in all namespaces called Ack which contains {RequestId, Namespace, State}
  3. In each namespace create a Business Service which would:
    1. Poll Requests/Ack tables to get new unprocessed requests (no corresponding Ack record).
    2. If an unprocessed request is found create an Ack record and send a message in a local namespace for BP processing
    3. 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.