go to post Michael Davidovich · Apr 24, 2023 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!
go to post Michael Davidovich · Apr 24, 2023 I would just recommend to anyone who comes across this to use a Python library like kafka-python. The documentation is clearer on how to configure the client or producer clearly. You can pass in a configuration to %External.Messaging but it's not clear how the parameters need to be formatted.
go to post Michael Davidovich · Apr 3, 2023 Setting the Java Home setting on the External Language server still gives me the same error in KaftaClient.jclient.gateway.
go to post Michael Davidovich · Apr 3, 2023 @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.
go to post Michael Davidovich · Mar 6, 2023 This issue ended up being the Session Cookie Scope. My application was set to 'Strict' and setting it to 'Lax' solved my problem. For now this is just fine to accept since that's the setup of our production server, but I do need to find some resources to understand why this mattered.
go to post Michael Davidovich · Mar 3, 2023 @Timo Lindenschmid Thanks for that suggestion! There's isn't a load balancer. I'm running IRIS on localhost and auth server is hosted with Okta.
go to post Michael Davidovich · Mar 1, 2023 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.
go to post Michael Davidovich · Mar 1, 2023 @Dmitry Maslennikov Thanks but it's most certainly the same web app (i.e. the name in the url hasn't changed "localhost/csp/theSameWebApp").
go to post Michael Davidovich · Feb 21, 2023 @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.
go to post Michael Davidovich · Feb 13, 2023 @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!
go to post Michael Davidovich · Feb 9, 2023 Thank you! Now that you say this I'm wondering I'm thinking either 1) maybe it's acutally not automatic in Postman or 2) (probably more likely) I was just testing things wrong (i.e. thinking I had a session with data in it when I didn't).
go to post Michael Davidovich · Feb 8, 2023 @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.
go to post Michael Davidovich · Feb 8, 2023 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.
go to post Michael Davidovich · Feb 8, 2023 While trying to do this I've used both my public IP address and my VPN IP address and I get the error Couldn't reach InterSystems IRIS at xxx.xx.x.xx:52773. One or both of your IP and Port are incorrect. Strangely I got this to work last week without having the IAM application or user enabled. That said I was able to access the IAM portal and set some stuff up but I'm not sure it was actually truly working. Any troubleshooting advice?
go to post Michael Davidovich · Feb 7, 2023 Pinging @Eduard Lebedyuk and @Stefan Wittmann to see if folks had additional thoughts.
go to post Michael Davidovich · Jan 26, 2023 Please correct me if I'm wrong but I found $system.Status.GetErrorText(sc) was the appropriate method to use over DisplayError() as DisplayError simply writes to the console and would not save to the database or a variable.
go to post Michael Davidovich · Jan 25, 2023 If one were to write or save %objlasterror's output to a database, how would one interpret these characters: 0 ß!> I find pretty consistently I get this as part of the output which I can work around but isn't helpful.