[Glass] Zinc Server in Gemstone

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Tue Nov 22 15:27:28 PST 2016


Mariano's code was close, but not quite correct:

(ZnServer on: 9090) start; delegate: myApp.
[true] whileTrue: [(Delay forSeconds: 1) wait]

The problem is that when control returns to the topaz prompt (or the 
tODE shell), the server process is  not running. Instead the client 
process (topaz or tODE) is waiting for input from the user. To run a 
server process in GemStone you must start your server in a forked 
process AND arrange to not return to the topaz (or tODE).

With a delay loop like the one above, your server should process all of 
the requests ...

The above code is a very simple zinc gem server ... as you work with 
GemStone more, you will probably find that you need to enhance the 
functionality of your "gem server" and I would recommend that you read 
the following document: "Getting started with Gem Servers"[1] to learn a 
bit more about the ins and outs or running gem servers with GemStone.



On 11/22/2016 02:52 PM, David Temnyk via Glass wrote:
> Hello Mariano, thank you for your answer.
> I tried what you said but sadly I got the same results.
> I can't understand why when I make a request from a Pharo Image 
> nothing happens until I send another request from either the tODE 
> shell or topaz...
> I must be doing something wrong but I can't figure out what it is.
> 2016-11-22 17:30 GMT-03:00 Mariano Martinez Peck 
> <marianopeck at gmail.com <mailto:marianopeck at gmail.com>>:
>     I am not sure about the following I will comment ... but... cannot
>     it be that the `eval` uses the same gem as the one running tODE
>     and that may cause some problems? Did you try running the
>     (ZnServer on: 9090) start; delegate: myApp
>     but from a `startTopaz` ?
>     $GS_HOME/bin/startTopaz myStone -l
>     Once inside topaz:
>     login
>     run
>     (ZnServer on: 9090) start; delegate: myApp
>     %
>     Cheers,
>     On Tue, Nov 22, 2016 at 4:27 PM, David Temnyk via Glass
>     <glass at lists.gemtalksystems.com
>     <mailto:glass at lists.gemtalksystems.com>> wrote:
>         Hi!
>         I'm trying to port some working Pharo code to Gemstone.
>         I have a small project which consists in sending some data
>         from different Pharo images to another one that simply stores
>         it in some object. In order to do that, I create a Zinc
>         Server, make it listen on port 9090 and delegate the requests
>         to my app, like this:
>         (ZnServer on: 9090) start; delegate: myApp.
>         In the other Pharo images I just send POST requests like this:
>         ZnEasy post: 'http://localhost:9090/store' data: (ZnEntity
>         text: someData).
>         This code is working but I'm running into some trouble trying
>         to port it to Gemstone. So far, I have loaded and tested my
>         app in Gemstone (without changing anything), but the server
>         part is giving me some headaches.
>         Right now i'm working with the gemstone shell in tODE. I tried
>         executing there this line of code:
>         eval `(ZnServer on: 9090) start; delegate: myApp`.
>         After doing this, I can send post requests from the shell
>         itself and it works, but when I try to send a request from a
>         Pharo image I get a "Data received time out". However, when I
>         send a POST request from the shell, all previous requests from
>         the Pharo Images are executed and all sets of data are stored.
>         So, if I send a POST request from a Pharo image and
>         immediately send a POST request from the Gemstone Shell, it
>         works: both sets of data are stored and both responses are
>         received.
>         But I would like it to work without having to send dummy post
>         requests from the shell. I don't understand what goes wrong.
>         Maybe I have to do things in a different way? I'm just
>         starting to work with Gemstone and there are a lot of concepts
>         that I don't quite get yet, but I'd really like to learn.
>         What can I do in order to make it work?
>         Thanks!
>         -- 
>         David Temnyk
>         _______________________________________________
>         Glass mailing list
>         Glass at lists.gemtalksystems.com
>         <mailto:Glass at lists.gemtalksystems.com>
>         http://lists.gemtalksystems.com/mailman/listinfo/glass
>         <http://lists.gemtalksystems.com/mailman/listinfo/glass>
>     -- 
>     Mariano
>     http://marianopeck.wordpress.com <http://marianopeck.wordpress.com>
> -- 
> David Temnyk
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20161122/34b3b22d/attachment-0001.html>

More information about the Glass mailing list