Archived

This forum has been archived. Please start a new discussion on GitHub.

How do I run two services in a single icebox?

I'm using Windows 7 x64, .NET and the latest version of ICE (v3.4.1).

How would I alter the demo in "C:\Ice-3.4.1-demos\democs\IceBox\hello" so that it ran two copies of the same service, one on port 10000, and one on port 20000?

Comments

  • Gravitas wrote: »
    I'm using Windows 7 x64, .NET and the latest version of ICE (v3.4.1).

    How would I alter the demo in "C:\Ice-3.4.1-demos\democs\IceBox\hello" so that it ran two copies of the same service, one on port 10000, and one on port 20000?

    Found the answer; posted it on: Using ICE from Zeroc, how do I configure Icebox in .NET to host two separate services? - Stack Overflow
  • bernard
    bernard Jupiter, FL
    Hi Shane,

    Welcome to our forums. It's good to see you were able to answer your own question :).

    With the solution you posted, you are really running2 similar services in the same IceBox (Hello and Hello2).

    It's also possible to run the very same service twice--Hello and again Hello, with the very same DLL (same Slice definition, same object adapter name etc). Only the configuration must be slightly different, since the two services can't use the same port for their respective object adapter.
    # 2 copies of the Hello service
     IceBox.Service.Hello=helloservice.dll:HelloServiceI --Ice.Config=config.service
     IceBox.Service.Hello2=helloservice.dll:HelloServiceI --Ice.Config=config2.service
    

    and in config2.service, you'd have:
    Hello.Endpoints=tcp -p 20000:udp -p 20000:ssl -p 20001
    

    This works because by default IceBox creates a new Ice communicator for each service it loads. If you share the same communicator between your IceBox services, you could not use the same object adapter name (here "Hello") for multiple object adapters within this communicator.

    Best regards,
    Bernard
  • bernard wrote: »
    It's also possible to run the very same service twice--Hello and again Hello, with the very same DLL (same Slice definition, same object adapter name etc). Only the configuration must be slightly different, since the two services can't use the same port for their respective object adapter.

    You are so correct, I've just tested it and it works beautifully. I've added a link to stackoverflow.com pointing back to this answer.

    By the way - congratulations on building such a beautifully designed product. I know elegant architecture when I see it. As one of my friends said, "ICE is a pleasure to code with".