Authors
- Nicola Pero (
nicola.pero@meta-innovation.com
)
-
Copyright: (C) 2012 Free Software Foundation, Inc.
- Declared in:
- EcBroadcastProxy.h
An EcBroadcastProxy instance forwards messages to multiple
servers via distributed objects. This is great if you
want to send a task to be repeated by multiple servers
in order to make a system more scalable.
You may
also design your servers so that you pass some sort of
identifier to let them know that one of them
(which recognises the identifier) should do one thing
while the others ignore it.
Finally, remote
servers are always listed in the same order, so you
can access them by their index; to get the host/name, you
can get it by asking the receiverNames and receiverHosts
and then looking up the one at the index you want. This
allows you to send specific messages to specific
servers.
Instance Variables
Method summary
- (id)
BCPproxy: (int)index;
The following one gives you back the proxy to talk to.
It automatically calls
-BCPraiseConnection:
to that server before sending you back a proxy. It
returns
nil
upon failure.
- (void)
BCPraiseConnection: (int)index;
Raise connection to server at index
- (void)
BCPraiseConnections;
Create connections to the receivers if needed. It is
called internally when a message to broadcast comes
in; but you may want to call this method in advance to
raise the connections so that when a message to
broadcast comes in, the connections are already
up and ready.
- (int)
BCPreceiverCount;
Get the number of receivers
- (NSArray*)
BCPreceiverHosts;
Get the list of server hosts
- (NSArray*)
BCPreceiverNames;
Get the list of server names
- (void)
BCPsetDelegate: (id)object;
Set a delegate.
The delegate object
gets the messages from the BCPdelegate informal
protocol upon connection loss and when a
connection is made.
- (NSString*)
BCPstatus;
Get a string describing the status of the broadcast
object
- (id)
initWithReceiverNames: (NSArray*)names
receiverHosts: (NSArray*)hosts;
This is a designated initialiser for the class.
Initializes the receiver creating connections
to the specified distributed objects servers. The
names are the DO ports (server-names) and
hosts are the names of the
machines those servers are running on (may be '*'
to find the server on any machine on the LAN, or an
empty string to find the server on the local host).
- (id)
initWithReceivers: (NSArray*)receivers;
Configuration array contains a list of
dictionaries (one for each receiver) - each
dictionary has two keys: `Name' and `Host', with
the corresponding values set.
Instance Variables for EcBroadcastProxy Class
@protected id delegate;
The delegate (if any)
@protected int idFailed;
Count of failed messages returning
id
@protected int idFullySent;
Count of completed messages returning
id
@protected int idPartiallySent;
Count of partial messages returning
id
@protected int onewayFailed;
Count of failed messages returning
void
@protected int onewayFullySent;
Count of completed messages returning
void
@protected int onewayPartiallySent;
Count of partial messages returning
void
@protected NSArray* receiverHosts;
The hosts the receiver objects are on
@protected NSArray* receiverNames;
The names of the receiver object
@protected NSMutableArray* receiverObjects;
The [proxies to the] individual remote objects
- Declared in:
- EcBroadcastProxy.h
The informal protocol listing messages which will be sent
to the EcBroadcastProxy's delegate if it responds to them.
Method summary
- (void)
BCP: (
EcBroadcastProxy*)proxy
lostConnectionToServer: (NSString*)name
host: (NSString*)host;
The method to notify the delegate that a connection to
an individual server process has been lost.
- (void)
BCP: (
EcBroadcastProxy*)proxy
madeConnectionToServer: (NSString*)name
host: (NSString*)host;
The method to notify the delegate that a connection to
an individual server process has been made.
enum EcBroadcastProxyError enum EcBroadcastProxyError;
This type enumerates the possible error conditions
occurring when sending a message to the proxy.
- BCP_NO_ERROR
-
A success
- BCP_COULD_NOT_CONNECT
-
Unable to connect to the server
- BCP_CONNECTION_WENT_DOWN
-
Lost connection while sending
- BCP_MESSAGING_TIMEOUT
-
Timeout while waiting for response