Hi,
Can IceBreak handle Microservices?
Re: Can IceBreak handle Microservices?
Hi;
IceBreak has changed dramatically over the years and added compiler feature in vsCode and support for routing so we can build microservices:
- Attached are a zipfile containing a microsevice demo. unzip that to /www/MicroServices on your IBMi before you create the IceBreak server.
-
Then create a server like this and start it:
IceBreak Server ID . . . . . . . > MICROSERV Name Description . . . . . . . . . . 'Microservices demo' Server type . . . . . . . . . . *WEB *SAME, *WEB, *NINJA... Tcp/Ip Interface address . . . . *ANY Tcp/Ip Port . . . . . . . . . . 60060 1-65535, *SAME Startup type . . . . . . . . . . *AUTO *SAME, *MANUAL, *AUTO Server Root Path . . . . . . . . '/www/MicroServices' Default doc or Startup script . 'default.html' Webconfig/shell file path . . . '/www/MicroServices/webconfig.xml'
Notice when you refer to a microservice, you always go through a "router" application. It is called "router.rpgle" and can be extended with logon stuff, security etc. and you have to make a "route" in the webconfig.xml pointing to that particular "router" application.
Microservices are not compiled by the JIT, since the router don't invoke the JIT compiler, so you have to compile it the vsCode or from 5250 commandline like:
CRTICEPGM STMF('/www/MicroServices/msSimple.rpgle') SVRID(microserv)
- I prefer vsCode, which are using node.js to compile IceBreak programs: download and install i from here
- Start vsCode and search for RPG in the "extensions". The "box on the left lower side: And install it ( Yes it is made by me and others for IceBreak;)
- Then map a drive M: to the /www/MicroServices folderand open - since that is a vsCode project. DON'T OPEN THE PROGRAM DIRECTLY - COMPILER WILL ONLY WORK ON PROJECTS !!!!
It must look like this - with the project outline in the left pane. open the msSimple.rpgle so the editor window shows (ensure you can see the .vsCode - that means that the compiler is active)
- Press shift + cmd + B (for run build task found in the "task" menu) ... and click on the "problems" tab if you have errors.. The click on the error line and the cursor will jump to the particular place in the code where the error is. COOL!!
- Run the sample:
now - the syntax: http://myIbmi:1234/router/serviceprogramname/procedureName
i.e to test the "msSimple.rpgle" service with the "Hello" attached. Then in my case I have an IBMi called dksrv206 and created a server called "MICROSERV" at port 60060
dksrv206:60060/router/msSimple/Hello?payload={ "message" : "My name is John" }
And the result - even more cool: always remember JSON in and JSON out for microservices. It makes you life so much easier.
Please give me feedback if you have issues.
Best regards,
Niels Liisberg