Ice.ObjectPrx

class Ice.ObjectPrx

Bases: ObjectPrx

The base class for all Ice proxies.

static uncheckedCast(proxy: ObjectPrx | None, facet: str | None = None) ObjectPrx | None

Creates a new proxy from an existing proxy.

Parameters:
  • proxy (ObjectPrx | None) – The source proxy.

  • facet (str | None, optional) – A facet name.

Returns:

A new proxy with the requested facet, or None if the source proxy is None.

Return type:

ObjectPrx | None

static checkedCast(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) ObjectPrx | None

Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.

Parameters:
  • proxy (ObjectPrx | None) – The source proxy.

  • facet (str | None, optional) – A facet name.

  • context (dict[str, str] | None, optional) – The request context.

Returns:

A new proxy with the requested facet, or None if the source proxy is None or if the target object/facet does not support the requested type.

Return type:

ObjectPrx | None

static checkedCastAsync(proxy: ObjectPrx | None, facet: str | None = None, context: dict[str, str] | None = None) Awaitable[ObjectPrx | None]

Creates a new proxy from an existing proxy after confirming the target object’s type via a remote invocation.

Parameters:
  • proxy (ObjectPrx | None) – The source proxy.

  • facet (str | None, optional) – A facet name.

  • context (dict[str, str] | None, optional) – The request context.

Returns:

An Awaitable that completes when the invocation completes. It holds a new proxy with the requested facet, or None if the source proxy is None or if the target object/facet does not support the requested type.

Return type:

Awaitable[ObjectPrx | None]

static ice_staticId() str

Returns the Slice type ID associated with this type.

Returns:

The Slice type ID.

Return type:

str

ice_getCommunicator() Communicator

Gets the communicator that created this proxy.

Returns:

The communicator that created this proxy.

Return type:

Communicator

Raises:

CommunicatorDestroyedException – If the communicator has been destroyed.

ice_isA(id: str, context: dict[str, str] | None = None) bool

Tests whether this object supports a specific Slice interface.

Parameters:
  • id (str) – The type ID of the Slice interface to test against.

  • context (dict[str, str] | None, optional) – The request context.

Returns:

True if the target object implements the Slice interface specified by id or implements a derived interface, False otherwise.

Return type:

bool

ice_isAAsync(id: str, context: dict[str, str] | None = None) Awaitable[bool]

Tests whether this object supports a specific Slice interface.

Parameters:
  • id (str) – The type ID of the Slice interface to test against.

  • context (dict[str, str] | None, optional) – The request context.

Returns:

An Awaitable that completes when the invocation completes. It holds True if the target object implements the Slice interface specified by id or implements a derived interface, False otherwise.

Return type:

Awaitable[bool]

ice_ping(context: dict[str, str] | None = None)

Tests whether the target object of this proxy can be reached.

Parameters:

context (dict[str, str] | None, optional) – The request context.

ice_pingAsync(context: dict[str, str] | None = None) Awaitable[None]

Tests whether the target object of this proxy can be reached.

Parameters:

context (dict[str, str] | None, optional) – The request context.

Returns:

An Awaitable that completes when the invocation completes.

Return type:

Awaitable[None]

ice_ids(context: dict[str, str] | None = None) list[str]

Returns the Slice interfaces supported by this object as a list of Slice type IDs.

Parameters:

context (dict[str, str] | None, optional) – The request context.

Returns:

The Slice type IDs of the interfaces supported by this object, in alphabetical order.

Return type:

list[str]

ice_idsAsync(context: dict[str, str] | None = None) Awaitable[list[str]]

Returns the Slice interfaces supported by this object as a list of Slice type IDs.

Parameters:

context (dict[str, str] | None, optional) – The request context.

Returns:

An Awaitable that completes when the invocation completes. It holds the Slice type IDs of the interfaces supported by the target object, in alphabetical order.

Return type:

Awaitable[list[str]]

ice_id(context: dict[str, str] | None = None) str

Returns the type ID of the most-derived Slice interface supported by this object.

Parameters:

context (dict[str, str] | None, optional) – The request context.

Returns:

The Slice type ID of the most-derived interface.

Return type:

str

ice_idAsync(context: dict[str, str] | None = None) Awaitable[str]

Returns the type ID of the most-derived Slice interface supported by this object.

Parameters:

context (dict[str, str] | None, optional) – The request context.

Returns:

An Awaitable that completes when the invocation completes. It holds the Slice type ID of the most-derived interface.

Return type:

Awaitable[str]

ice_invoke(operation: str, mode: OperationMode, inParams: bytes, ctx: dict[str, str] | None = None) tuple[bool, bytes]

Invokes an operation dynamically.

Parameters:
  • operation (str) – The name of the operation to invoke.

  • mode (OperationMode) – The operation mode (normal or idempotent).

  • inParams (bytes) – An encapsulation containing the encoded in-parameters for the operation. You can pass an empty byte string when the operation takes no in-parameters; the Ice runtime then marshals an empty encapsulation.

  • ctx (dict[str, str] | None, optional) – The request context.

Returns:

A success flag and an encapsulation. If the operation completed successfully, the flag is True and the encapsulation contains the encoded out-parameters and return value (the return value follows any out-parameters). If the operation raised a user exception, the flag is False and the encapsulation contains the encoded user exception. If the operation raised a runtime exception, this method raises it directly. When this proxy is a oneway, datagram, or batch proxy, the flag is always True and the encapsulation is empty.

Return type:

tuple[bool, bytes]

ice_invokeAsync(operation: str, mode: OperationMode, inParams: bytes, ctx: dict[str, str] | None = None) Awaitable[tuple[bool, bytes]]

Invokes an operation dynamically.

Parameters:
  • operation (str) – The name of the operation to invoke.

  • mode (OperationMode) – The operation mode (normal or idempotent).

  • inParams (bytes) – An encapsulation containing the encoded in-parameters for the operation. You can pass an empty byte string when the operation takes no in-parameters; the Ice runtime then marshals an empty encapsulation.

  • ctx (dict[str, str] | None, optional) – The request context.

Returns:

An Awaitable that completes when the invocation completes. It holds a success flag and an encapsulation. If the operation completed successfully, the flag is True and the encapsulation contains the encoded out-parameters and return value (the return value follows any out-parameters). If the operation raised a user exception, the flag is False and the encapsulation contains the encoded user exception. If the operation raised a runtime exception, the Awaitable raises it directly. When this proxy is a oneway, datagram, or batch proxy, the flag is always True and the encapsulation is empty.

Return type:

Awaitable[tuple[bool, bytes]]

ice_getIdentity() Identity

Gets the identity embedded in this proxy.

Returns:

The identity of the target object.

Return type:

Identity

ice_identity(newIdentity: Identity) ObjectPrx

Creates a proxy that is identical to this proxy, except for the identity.

Parameters:

newIdentity (Identity) – The identity for the new proxy.

Returns:

A proxy with the new identity.

Return type:

ObjectPrx

ice_getContext() dict[str, str]

Gets the per-proxy context for this proxy.

Returns:

The per-proxy context (an empty dictionary when this proxy has no per-proxy context).

Return type:

dict[str, str]

ice_context(new_context: dict[str, str]) Self

Creates a proxy that is identical to this proxy, except for the per-proxy context.

Parameters:

new_context (dict[str, str]) – The context for the new proxy.

Returns:

A proxy with the new per-proxy context.

Return type:

Self

ice_getFacet() str

Gets the facet for this proxy.

Returns:

The facet for this proxy. If the proxy uses the default facet, the return value is the empty string.

Return type:

str

ice_facet(new_facet: str) ObjectPrx

Creates a proxy that is identical to this proxy, except for the facet.

Parameters:

new_facet (str) – The facet for the new proxy.

Returns:

A proxy with the new facet.

Return type:

ObjectPrx

ice_getAdapterId() str

Gets the adapter ID for this proxy.

Returns:

The adapter ID. If the proxy does not have an adapter ID, the return value is the empty string.

Return type:

str

ice_adapterId(newAdapterId: str) Self

Creates a proxy that is identical to this proxy, except for the adapter ID.

Parameters:

newAdapterId (str) – The adapter ID for the new proxy.

Returns:

A proxy with the new adapter ID.

Return type:

Self

ice_getEndpoints() tuple[Endpoint, ...]

Gets the endpoints used by this proxy.

Returns:

The endpoints used by this proxy.

Return type:

tuple[Ice.Endpoint, …]

ice_endpoints(newEndpoints: tuple[Endpoint, ...] | list[Endpoint]) Self

Creates a proxy that is identical to this proxy, except for the endpoints.

Parameters:

newEndpoints (tuple[Ice.Endpoint, ...] | list[Ice.Endpoint]) – The endpoints for the new proxy.

Returns:

A proxy with the new endpoints.

Return type:

Self

ice_getLocatorCacheTimeout() int

Gets the locator cache timeout of this proxy.

Returns:

The locator cache timeout value (in seconds).

Return type:

int

ice_locatorCacheTimeout(timeout: int) Self

Creates a proxy that is identical to this proxy, except for the locator cache timeout.

Parameters:

timeout (int) – The new locator cache timeout (in seconds).

Returns:

A proxy with the new timeout.

Return type:

Self

ice_invocationTimeout(timeout: int) Self

Creates a proxy that is identical to this proxy, except for the invocation timeout.

Parameters:

timeout (int) – The new invocation timeout (in milliseconds).

Returns:

A proxy with the new timeout.

Return type:

Self

ice_getInvocationTimeout() int

Gets the invocation timeout of this proxy.

Returns:

The invocation timeout value (in milliseconds).

Return type:

int

ice_isConnectionCached() bool

Determines whether this proxy caches connections.

Returns:

True if this proxy caches connections, False otherwise.

Return type:

bool

ice_connectionCached(newCache: bool) Self

Creates a proxy that is identical to this proxy, except for connection caching.

Parameters:

newCache (bool) – True if the new proxy should cache connections, False otherwise.

Returns:

A proxy with the specified caching policy.

Return type:

Self

ice_getEndpointSelection() EndpointSelectionType

Gets the endpoint selection policy for this proxy (randomly or ordered).

Returns:

The endpoint selection policy.

Return type:

EndpointSelectionType

ice_endpointSelection(newType: EndpointSelectionType) Self

Creates a proxy that is identical to this proxy, except for the endpoint selection policy.

Parameters:

newType (EndpointSelectionType) – The new endpoint selection policy.

Returns:

A proxy with the specified endpoint selection policy.

Return type:

Self

ice_encodingVersion(version: EncodingVersion) Self

Creates a proxy that is identical to this proxy, except for the encoding used to marshal parameters.

Parameters:

version (EncodingVersion) – The encoding version to use to marshal request parameters.

Returns:

A proxy with the specified encoding version.

Return type:

Self

ice_getEncodingVersion() EncodingVersion

Gets the encoding version used to marshal request parameters.

Returns:

The encoding version.

Return type:

EncodingVersion

ice_getRouter() RouterPrx | None

Gets the router for this proxy.

Returns:

The router for the proxy. If no router is configured for the proxy, the return value is None.

Return type:

RouterPrx | None

ice_router(router: RouterPrx | None) Self

Creates a proxy that is identical to this proxy, except for the router.

Parameters:

router (RouterPrx | None) – The router for the new proxy.

Returns:

A proxy with the specified router.

Return type:

Self

ice_getLocator() LocatorPrx | None

Gets the locator for this proxy.

Returns:

The locator for this proxy. If no locator is configured, the return value is None.

Return type:

LocatorPrx | None

ice_locator(locator: LocatorPrx | None) Self

Creates a proxy that is identical to this proxy, except for the locator.

Parameters:

locator (LocatorPrx | None) – The locator for the new proxy.

Returns:

A proxy with the specified locator.

Return type:

Self

ice_isCollocationOptimized() bool

Determines whether this proxy has collocation optimization enabled.

Returns:

True if this proxy has collocation optimization enabled, False otherwise.

Return type:

bool

ice_collocationOptimized(collocated: bool) Self

Creates a proxy that is identical to this proxy, except for collocation optimization.

Parameters:

collocated (bool) – True if the new proxy enables collocation optimization, False otherwise.

Returns:

A proxy with the specified collocation optimization.

Return type:

Self

ice_twoway() Self

Creates a proxy that is identical to this proxy, but uses twoway invocations.

Returns:

A proxy that uses twoway invocations.

Return type:

Self

ice_isTwoway() bool

Determines whether this proxy uses twoway invocations.

Returns:

True if this proxy uses twoway invocations, False otherwise.

Return type:

bool

ice_oneway() Self

Creates a proxy that is identical to this proxy, but uses oneway invocations.

Returns:

A proxy that uses oneway invocations.

Return type:

Self

ice_isOneway() bool

Determines whether this proxy uses oneway invocations.

Returns:

True if this proxy uses oneway invocations, False otherwise.

Return type:

bool

ice_batchOneway() Self

Creates a proxy that is identical to this proxy, but uses batch oneway invocations.

Returns:

A proxy that uses batch oneway invocations.

Return type:

Self

ice_isBatchOneway() bool

Determines whether this proxy uses batch oneway invocations.

Returns:

True if this proxy uses batch oneway invocations, False otherwise.

Return type:

bool

ice_datagram() Self

Creates a proxy that is identical to this proxy, but uses datagram invocations.

Returns:

A proxy that uses datagram invocations.

Return type:

Self

ice_isDatagram() bool

Determines whether this proxy uses datagram invocations.

Returns:

True if this proxy uses datagram invocations, False otherwise.

Return type:

bool

ice_batchDatagram() Self

Creates a proxy that is identical to this proxy, but uses batch datagram invocations.

Returns:

A proxy that uses batch datagram invocations.

Return type:

Self

ice_isBatchDatagram() bool

Determines whether this proxy uses batch datagram invocations.

Returns:

True if this proxy uses batch datagram invocations, False otherwise.

Return type:

bool

ice_compress(compress: bool) Self

Creates a proxy that is identical to this proxy, except for its compression setting which overrides the compression setting from the proxy endpoints.

Parameters:

compress (bool) – True enables compression for the new proxy, False disables compression.

Returns:

A proxy with the specified compression override setting.

Return type:

Self

ice_getCompress() bool | None

Gets the compression override setting of this proxy.

Returns:

The compression override setting. If None is returned, no override is set. Otherwise, True if compression is enabled, False otherwise.

Return type:

bool | None

ice_connectionId(connectionId: str) Self

Creates a proxy that is identical to this proxy, except for its connection ID.

Parameters:

connectionId (str) – The connection ID for the new proxy. An empty string removes the connection ID.

Returns:

A proxy with the specified connection ID.

Return type:

Self

ice_getConnectionId() str

Gets the connection ID of this proxy.

Returns:

The connection ID.

Return type:

str

ice_fixed(connection: Connection) Self

Creates a proxy that is identical to this proxy, except it’s a fixed proxy bound to the given connection.

Parameters:

connection (Connection) – The fixed proxy connection.

Returns:

A fixed proxy bound to the given connection.

Return type:

Self

ice_isFixed() bool

Determines whether this proxy is a fixed proxy.

Returns:

True if this proxy is a fixed proxy, False otherwise.

Return type:

bool

ice_getConnection() Connection | None

Gets the connection for this proxy. If the proxy does not yet have an established connection or its connection is closed or being closed, it first attempts to create a new connection. For a fixed proxy, this method returns the connection this proxy is bound to, even when this connection is closed.

Returns:

The Connection for this proxy.

Return type:

Connection | None

Notes

You can call this method to establish a connection or associate the proxy with an existing connection and ignore the return value.

When this proxy reaches its target object through collocation optimization (see ice_collocationOptimized()), this method returns None: collocated invocations don’t use a connection.

ice_getConnectionAsync() Awaitable[Connection | None]

Gets the connection for this proxy. If the proxy does not yet have an established connection or its connection is closed or being closed, it first attempts to create a new connection. For a fixed proxy, the returned Awaitable holds the connection this proxy is bound to, even when this connection is closed.

Returns:

An Awaitable that completes when the connection is available. It holds the Connection for this proxy.

Return type:

Awaitable[Connection | None]

Notes

You can call this method to establish a connection or associate the proxy with an existing connection and ignore the result.

When this proxy reaches its target object through collocation optimization (see ice_collocationOptimized()), the Awaitable holds None: collocated invocations don’t use a connection.

ice_getCachedConnection() Connection | None

Gets the Connection cached by this proxy. Once this proxy has been associated with a connection (typically during its first invocation), it caches this connection and continues using it for subsequent invocations, until an invocation on this proxy fails. This method never attempts to establish a connection. For a fixed proxy, this method returns the connection this proxy is bound to, even when this connection is closed. This method never raises an exception.

Returns:

The cached connection, or None if this proxy doesn’t have a cached connection. The returned connection can be closed.

Return type:

Connection | None

Notes

A proxy with connection caching disabled (see ice_connectionCached()) never caches a connection: for such a proxy, this method always returns None. This method also returns None when this proxy reaches its target object through collocation optimization (see ice_collocationOptimized()): collocated invocations don’t use a connection.

ice_flushBatchRequests() None

Flushes any pending batched requests for this proxy. The call blocks until the flush is complete.

Return type:

None

ice_flushBatchRequestsAsync() Awaitable[None]

Flushes any pending batched requests for this proxy. The call does not block.

Returns:

An Awaitable that completes when the flush completes.

Return type:

Awaitable[None]

ice_toString() str

Creates a stringified version of this proxy.

Returns:

A stringified proxy.

Return type:

str