Eduard Lebedyuk · Mar 5, 2019 go to post

Some ideas.

1. The problem is isc.rabbitmq.API  class was imported with an error. Delete this class and try this code (post output):

Set class = "isc.rabbitmq.API"
Set classPath = ##class(%ListOfDataTypes).%New()
Do classPath.Insert(PATH-TO-JAR)
Set gateway = ##class(%Net.Remote.Gateway).%New() 
Set sc = gateway.%Connect("localhost", PORT, $Namespace, 2, classPath)
Zwrite sc
Set sc = gateway.%Import(class)
Zwrite sc
Write ##class(%Dictionary.CompiledClass).%ExistsId(class)

2. Try recompiling isc.rabbitmq.API  class.

3. Maybe have 2 amqp jars with com.rabbitmq.tools.jsonrpc.JsonRpcException class.  The only class you should import is isc.rabbitmq.API  class. It shouldn't pull many additional ones.

4. What version of AMQP are you using? I'm using amqp-5.0.0. Try the same verison?

Eduard Lebedyuk · Mar 4, 2019 go to post

Great to see more AoC participants!

Also please note, that $ListValid returns 1/0 (%Boolean) and not a %Status. So $system.Status methods won't work.

set status = $LISTVALID(list)

you can write something like this:

set isValid = $listValid(list)
if isValid {
  // main code
} else {
  write "List is invalid:",!
  zwrite list
}
Eduard Lebedyuk · Mar 2, 2019 go to post

Abstract class could have this method:

ClassMethod GetNew() As test.Order {
  set class = "test.Order"
  if ..GetCompileDate($classname())'=..GetCompileDate(class) {
    set sc = $system.OBJ.Compile($classname(),"cukb /display=none")
  }
  quit $classmethod(class, "%New")
}

ClassMethod GetCompileDate(class As %Dictionary.CacheClassname) [CodeMode = expression]
{
$$$comClassKeyGet(class,$$$cCLASStimechanged)
}

Eduard Lebedyuk · Mar 1, 2019 go to post

Eduard, that's a good suggestion, but one issue I see is that if you are processing millions of documents, that's a lot of database overhead. Using a simple global reference with locks would work better as you would only have n files persisted up to the Pool Size. 

The solution I outlined at all times contains exactly up to PoolSize records, so I don't think it's a very big overhead. You can lock filenames I suppose, why not?

My next challenge is to determine a better way for the file service to pick off files from the OS folder without loading all the files into a potentially massive result set which can blow out local memory and in extreme cases quickly blow out CacheTemp DB size.

Ensemble File inbound adapter uses FileSet from %File class. This query uses $zsearch to iterate over files in a directory and populates a ppg with results at once. Calling Next on that result set only moves the ppg key. You can rewrite FileSet query to advance $zsearch  on a Next call. Don't know how it would affect performance though.

Eduard Lebedyuk · Mar 1, 2019 go to post

I suppose you can solve this problem by separating your persistent class into abstract definition and persistent "storage only" class.

It could look like this:

Class test.Abstract.Order [ Abstract ]

{

Property a;

Method doStuff()

{

}

}

and persistent class:

Class test.Order Extends (test.Abstract.Order, %Persistent)

{

/*Generated Storage */

}

And only map test.Abstract package. This way you'll need to:

  • Copy test.Order class manually (but only once, as it does not change).
  • Recompile test.Order class in each namespace if Abstract realization changes.

But in this setup persistent class could be tuned, etc.. Also you can automate deployment steps with CI/CD tools.

Eduard Lebedyuk · Feb 27, 2019 go to post

What does this command return?

dumpbin /headers c:/InterSystems/IRIS_2019/CSP/bin/CSPa24.dll

For me (on IRIS for Windows (x86-64) 2018.2 (Build 241U) Fri Jan 26 2018 01:06:37 EST) it shows:

Dump of file ./CSPa24.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
             14C machine (x86)
               5 number of sections
        5BC558F7 time date stamp Tue Oct 16 06:20:23 2018
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
            2102 characteristics
                   Executable
                   32 bit word machine
                   DLL

Note 14C machine (x86) value, it means that it's a 32bit dll. If you have similar output, I recommend installing 32 bit apache.

Eduard Lebedyuk · Feb 26, 2019 go to post

I have not tested the code on Windows, but here's my idea.

As you can see in the code for test method in cause of exceptions I end all my processes with

do $system.Process.Terminate(, 1)

it seems this path is getting hit.

How to fix this exception:

  1. Check that test method actually gets called. Write to a global in a first line.
  2. In exception handler add do ex.Log() and check application error log to see exception details.
Eduard Lebedyuk · Feb 26, 2019 go to post

I recommend locking as a solution to that problem.

Create a table/class/global which holds {filename, lock, ownerJobId}.

All service jobs execute the same file search, take first filename, check the lock table. If it's empty - write into it and start processing the file.

If lock table has the entry take the next file, till you find one without lock.

After file is processed delete/move it and remove the entry from lock table.

On job shutdown purge the table records associated with job id.

This way you can scale jobs easily.

Eduard Lebedyuk · Feb 25, 2019 go to post

Here's how you can do it:

  1. Download CSPGateway kit from WRC  for 2017.2.1
  2. Install it on a new server
  3. Connect it to IIS
  4. Open csp/bin/Systems/Module.cxw and add required application(s)

I think this documentation page describes exactly what you want to do.

Eduard Lebedyuk · Feb 24, 2019 go to post

You get this error (Datatype value '2019-02-01' is not a valid number) because %Date stores data in horolog format, so you need to do one of:

  • (Recommended approach) Convert date value from external format (2019-02-01) into internal format (horolog) using $zdh function:
Set consumerRecord.ActivePeriod.StartDate = $zdh(obj.activePeriod.startDate, 3)
  • Use datatype for which this value is valid, i.e. %TimeStamp. To check, all datatype classes offer IsValid method, you can use it to check value validity
zw ##class(%TimeStamp).IsValid("2019-02-01")
  • If you're using InterSystems IRIS you can store dates as %PosixTime.

Regarding Atelier, I use it to debug REST services and it shows variable values. You can try to reinstall it. If you're on Windows you can also use Studio.

Eduard Lebedyuk · Feb 23, 2019 go to post
  1. Go to SMP - Menu - Manage Web Applications.
  2. Open /csp/healthshare/hspc/  application settings.
  3. Check that Inbound Web Services are enabled for the application.
  4. Press Save button.

Eduard Lebedyuk · Feb 22, 2019 go to post

Small addition: objects are always passed by reference, so usually you don't need to pass them with dot.

Eduard Lebedyuk · Feb 22, 2019 go to post

What does this output in a terminal:

set respText="{""access_token"":""4SDFDSFDSF-aSDASDASD"",""expires_in"":""3300"",""refresh_token"":"""",""scope"":""sms_send"",""token_type"":""Bearer""}"  
set sc = ##class(%ZEN.Auxiliary.jsonProvider).%ParseJSON(respText,,.pObject,1)
zw pObject

I tried it on a later verison and got:

pObject=<OBJECT REFERENCE>[1@%ZEN.proxyObject]
+----------------- general information ---------------
|      oref value: 1
|      class name: %ZEN.proxyObject
| reference count: 2
+----------------- attribute values ------------------
|           %changed = 1
|%data("access_token") = "4SDFDSFDSF-aSDASDASD"
|%data("expires_in") = 3300
|%data("refresh_token") = ""
|     %data("scope") = "sms_send"
|%data("token_type") = "Bearer"
|             %index = ""
+-----------------------------------------------------
Eduard Lebedyuk · Feb 22, 2019 go to post

That is a fairly common problem - the need to compare two different codebases. It could be a test and prod server or just different production servers. Anyway I usually compare them like this:

  1. Install source control hook (I prefer cache-tort-git udl fork but any udl based will do) on all affected servers.
  2. Export everything from the base server (with oldest sources) using source control hook into a new repostory.
  3. Commit this state as an initial state.
  4. Clone the repository with initial state to the other server.
  5. Export everything from the other server into the repository.
  6. Commit again (if you have more than two parallel codebases you may need to branch out).
  7. Use any commit viewer to see the difference (I prefer GitHub/GitLab).
Eduard Lebedyuk · Feb 22, 2019 go to post

Looks like it works correctly.

write pObject

outputs the object oref.

If you want to display the whole object, use zwrite:

zwrite pObject

If you need a specific property, access them like this:

write pObject."access_token"

write pObject.in
Eduard Lebedyuk · Feb 20, 2019 go to post

I don't think you can have a root (/) maps as it would create unwanted ambiguity.

Why not put the  / routes directly into My.Code.BS.ApiRoute?

Eduard Lebedyuk · Feb 20, 2019 go to post

Please do not use DES as it's currently a broken cypher with bruteforce time of about a day.

Eduard Lebedyuk · Feb 19, 2019 go to post

Yes,  that would work for notification.

The main issue is resuming from where things went wrong.

Eduard Lebedyuk · Feb 19, 2019 go to post

My goal is not to reexecute the process, but rather resume from the point I got an error (or immediately before, i.e. on a last successfull request/response).

Eduard Lebedyuk · Feb 19, 2019 go to post

I don't think it's possible.

You can spawn cterm from powershell with

ccontrol cterminal ENSEMBLE

Eduard Lebedyuk · Feb 19, 2019 go to post

Is that a production instance?

Is that 8bit or Unicode instance?

What I/O tables NLS routine shows? (Note that modifying locales/defaults can be potentially application-breaking change so do it only if you know what you're doing)

zn "%SYS"

do ^NLS
 
 
1) Display current locale
2) Select defaults
3) Change locale
4) Display loaded settings
5) Advanced
 
NLS option? 2
 
1) Internal tables
2) I/O tables
3) CSP files
4) Date, time and number formats
 
Category of defaults? 2
 
Items marked with (*) represent the locale's original default
 
I/O table              Current default
---------------------  --------------------
 
1) Process             RAW (*)
2) Cache Terminal      UTF8 (*)
3) Other terminal      UTF8 (*)
4) File                UTF8 (*)
5) Magtape             UTF8 (*)
6) TCP/IP              RAW (*)
7) System call         RAW (*)
8) Printer             CP1251 (*)