Home Help Center

IceIdentity to Proxy in ruby

PeteHPeteH Member Peter HugOrganization: Warehouse Optimization LLCProject: APAL
All my objects have an identity where the name is a JSON structure. The category can always be implied within each context of my Ruby on Rails web application. When a request comes in, I create an Ice::Identity:

Now I need to convert this Identity to a proxy, but how?


  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    Since you are talking about Ice for Ruby which does not have server side support I assume you mean you want to call on some server hosting the Ice object with that constructed identity. You have a variety of options. The first is to have some factory object to return the proxy hosted in the server. Something like:
    interface Factory
       object* createProxy(Ice::Identity id);

    Then call on that factory, and viola you have the proxy.

    The second simpler way is to construct the stringified proxy on the fly in your client and then call Communicator::stringToProxy. This, however, means you need to know the server endpoints in the client, which reduces your flexibility for later security, load balancing and deployment. The stringified proxy would be something like:

    "CustomerI/#{param[:key]}":tcp -h somehost.com -p 15000
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    If you use IceGrid, the stringified proxy passed to stringToProxy could also represent an indirect proxy, such as:
    CustomerI/#{param[:key]} (a "well-known" proxy)

    Then it's IceGrid that takes care of load-balancing, port numbers etc.

  • PeteHPeteH Member Peter HugOrganization: Warehouse Optimization LLCProject: APAL
    Thanks Bernard and Matthew.

    In the meantime I implemented factories as you Matthew suggested. What I sort of expected to find somewhere around the Ice::Communicator interface was a method that would return an Ice::Connection proxy which in turn I could use to create a proxy from my dynamically generated Ice::Identity.

    While I really love Ice and reckon you guys have done a fantastic job, I do miss a reference manual. The ~1600 page pdf users manual is excellent to get started and to review concepts, but it is cumbersome to use as reference manual.

    Bernard, I realise now that I need to read a bit about IceGrid. Our application as ever only a couple or so concurrent users so I'm less concerned with performance issues.
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    You can find an API reference manual online. It documents all of the Slice interfaces in Ice.


Sign In or Register to comment.