Thanks @Luis Angel Pérez Ramos!

Yes, agreed on DTLs for HL7 - it's built for that!  In my case, yes, it's a custom object.  Also, I think for my use I will keep the request from the service to the process (the mapped record to the processing) as async.  

So I'm still a little unclear and, yes I have read and reread that page of documentation but I'm left with questions.  Let me stub out some code to see if I can narrow down my thoughts (sorry I'm really clumsey with this editor)

Class BusinessProcess extends Ens.BusinessProcess {

Method OnRequest(request as Record.From.Mapper, response as MyCustomObject) as %Status {

  // does it make sense that my response is here the custom object 
  // I'm transforming my record to?  i don't see a need to create a 
  // whole new response class just to say the record was completed . . . 
  // either the response is "" or an instance of MyCustomObject

  s response=##class(MyCustomObject).%New()
  s response.rawData1=$e(request.PropertyToExtractFrom)
  s response.RawData2=$zstrip($p(request.DelimitedProperty,""|",2),"<>W")
  d response.%Save()

  // this is where i'm sacrificing the dtl and bpl for just simple code - 
  // sounds like you say you do this for custom objects, so i think i'm good

  q $$$OK

  // does the response even matter here?  i'm not sending it to a business 
  // operation, however we do have a kind of dummy business operation we can 
  // use to send the response to and nothing happens, just kind of an ending 
  // point to say "we're done and there was no issues".

  // so i could implement something like:
  // ..SendRequestAsync("DummyOperationToSayWe'reDone",0) q 1

}

Method OnResponse(request As %Library.Persistent, ByRef response As %Library.Persistent, callrequest As %Library.Persistent, callresponse As %Library.Persistent, pCompletionKey As %String) As %Status

{

  // the documentation says i must implement this but i was able to compile without . . . 
  // you also seem to indicate it's optional.  since i'm not handling any responses 
  // from any of the business hosts this isn't necessary to implement i think.  
  // if i were to implement request would be an instance of Record.From.Mapper and 
  // response would be the response defined in the business process or operation, yes?

  q $$$OK

}

This is great!

I would love to see an article about Dockeriz-ing legacy applications including how to manifest your system's current security configurations and other important configs like OAuth servers, productions, and SSL configs.  

Most articles and example seemed geared to "here's a fresh copy of IRIS for you to do your thing!"  I have sat with the Docker template in the InterSystems community Git repo many times only to find myself with a half working version of my current application.  I also am not that good with Docker in the first place so I admit I have short comings and much to learn still.  

@Evgeny Shvarov my hacky way of doing this is to create an untracked mac file with ROUTINE debug defined.

I just swap in the suite or method I want to run per Alex's instructions, set my breakpoints in VS code and make sure the debug configuration is in my VSCode settings:

    "launch": {

        "version": "0.2.0",

        "configurations": [

            {

                "type": "objectscript",

                "request": "launch",

                "name": "debugRoutine",

                "program": "^debug"

            }

        ]

    }

@Yaron Munz 
What are these Methods,Triggers,Incidies and Storages properties or params on the DestCls?  I don't see them as part of the %Persistent class or any super classes in the class reference, so I'm wondering exactly what you're referencing here?

I tested this on my command line and I get:

W clone.Methods.Count()
^
<PROPERTY DOES NOT EXIST>

Was this pseudo code for something or are they properties that you defined in the class?

Thanks, @Timothy Leavitt!

This was incredibly helpful.  I modified it a bit as that $CASE statement would have grown over time into something not fun to manage.

I created the main dispatch class and prepended the version to the pUrl parameter in the OnPredispatch method and then passed that into a main router class using DispatchRequest similar do what you did there.  We can maintain the routemap in that main router class to keep things more organized and standard and from there it simply acts as normal.

THANK YOU!

@Eduard Lebedyuk thanks for your response here!

I changed directions and used embedded Python and a library called kafka-python which appears to be well-used and supported.  Using this, I've had no issues getting connected to my server, plus now I have access to more commands for Kafka.  

Before I edit or setup a new External Language Server 1) do you think the %Net.Remote.Exception is related to the Java Home on the external language server not being setup and 2) if I had multiple external language servers setup, how would I tell %External.Messaging (and specifically the Kafka client) to use one or the other?

It would be ideal to stick with COS libraries and features, but I think the Python library is the best solution as it offers more in terms of an API, but I'd still like to get %External.Messaging working for other purposes.

Thanks.  We use them quite a bit and from what I can tell, yes the session ID is changing so I suppose I'm trying to target what even is happening that's restarting the session.  

I could understand that it might get haywire after going back and forth from the auth server, however, I'm losing my session after I've done my business with the auth server and all I'm doing is continuing to talk to the Cache server as usual.

I'm sure my issue is probably super application specific, but I thought I'd see if others had any ideas.

@Jason Jones after I posted this I forgot that @Timothy Leavitt had sent me this example of Open API generation not as an alternative to api/mgmt/v1 but as an alternative to using the package manager and the isc-rest opensource code.  

isc-ipm-js/openApiProcessor.cls at main · intersystems/isc-ipm-js (github.com)

I'm not exactly sure this answers my question about using api/mgmt/v1 to generate the spec but it could lead to some clues?  You can see the discussion here:

Projecting JSON · Discussion #22 · intersystems/isc-rest (github.com)

There's a lot to examine here but I don't think it's the simple solution we're looking for.  I personally have been sticking with the IS spec first approach as it's quite easy to implement so far.  The biggest challenge has been developing on the client side when the source code is generated on the server.  

@Heloisa Paiva 
Thanks for this great primer.

Does embedded Python support return values?  I don't see any examples here or on the IRIS documentation of class methods using embedded Python returning a value.

Also, is there a well documented source for the iris Python package?  I was following the documentation to read a global using iris.gref("^Global") to read the global from the keys and it took testing it on the API command line to find that to get a value at a global with multiple keys I had pass in something like globalRef.get(["key1","key2"]).  Not horrible to figure out but for someone used to COS it would be helpful 1) know what the iris package has in it and 2) how to use them without testing them each time.

Thank!

@Eduard Lebedyuk I get the sense that you think I'm not reading the documentation since you've linked it on this thread about three times. 

I promise, I really am trying to do my due diligence and I have been reading the online documentation, so I'm sorry if I've frustrated you.

While testing, I see I can easily set %session.Data to hold data I want to preserve.  I guess the issue I'm having boils down to how do you preserve that across REST calls?  Obviously step one is setting UseSession=1.

Using Postman I see I'm returned cookies that hold session paths and ID after making a call:

So maybe the question I'm trying to ask is, how, on my next API call can I use that session path in the cookie that may, for example, verify that a user has logged in to my system?

I understand this isn't ideal, but it's how the system work at the moment.

Without pasting a ton of code here, the basic question is can you utilize the %session variable when using /api/mgmnt/?  When UseSession is set to true, the use to %session results in error.

I'm aware that REST by definition doesn't use sessions, but our existing application does use %session for authentication and other data and the idea is to take a "first step" into REST without totally redesigning everything.

Tha said here's a small example of what I've played with:

The idea was that the client would have previously called a Login API to log the user in and setup %session.  Future API calls would use the %session variable to validate user access.  This is similar to how our web application works today.