Oracle Server E10293-02 Benutzerhandbuch

Seite von 108
IP and Routes Configuration
B-2
Oracle Communication and Mobility Server Developer’s Guide
String localURI = 
"
aaa://server.realm.domain.com:41001
"
;
myStack.createDiameterListeningPoint(localURI);
As soon as the listening point has been created, the Diameter stack is ready to accept 
incoming connection from remote peers. If the Diameter stack receives a connection 
request from a peer that as not been declared in the routing table, then the 
isUnknownPeerAuthorized()
 of the DiameterListener interface is called. The 
connection is accepted only if this method returns true.
Configuring Routes and Binding to Diameter Peers
A Diameter client application can declare remote peers by using the 
createDiameterRoute()
method.
The code fragment illustrated in 
 configures two Diameter realms, 
realm1.domain.com
 and realm2.domain.com. The first realm is served by two 
peers: peer1.realm1.domain.com and peer2.realm1.domain.com, whereas 
the second realm is served by only one peer, peer.realm2.domain.com. The metric 
values (1 and 2) are such that peer1 and peer2 are set up in master/backup mode. 
 illustrates this source code for setting up this peer configuration.
Example B–1
Configuring Peers
myStack.createDiameterRoute(
"
ExampleApp
"
"
realm1.domain.com
"
,
                            
"
aaa://peer1.realm1.domain.com
"
, 1);
myStack.createDiameterRoute(
"
ExampleApp
"
"
realm1.domain.com
"
,
                            
"
aaa://peer2.realm1.domain.com
"
, 2);
myStack.createDiameterRoute(
"
ExampleApp
"
"
realm2.domain.com
"
,
                            
"
aaa://peer.realm2.domain.com:41002
"
, 1);
Realm State Availability
The DiameterRealmStateChangeEvent class is used to notify the application of 
the reachability or unreachability of a remote realm as a result of peers coming up or 
down. This is important because the Diameter stack will not accept an outgoing 
message for which the remote realm is not available. Therefore, the application should 
wait until the realm is available before sending requests.
A RealmStateChange event is passed to DiameterListener.processEvent() 
whenever the availability of a pair (Remote-Realm, Application-ID) changes. The 
availability of a remote realm for a given application ID depends on the availability of 
active connections to at least one remote peer that is able to serve the specific realm 
Note:
There is no need for the user application to keep the references 
on the listening points since they can be retrieved later by calling 
DiameterStack.getDiameterListeningPoints()
.
Note:
If a peer name (FQDN) is used in createDiameterRoute() 
and if that peer is not yet known to the local stack, a transport 
connection is initiated with the peer using the specified peer URI 
(taking into account any URI optional information such as port 
number and transport protocol). On the contrary, if the peer specified 
by the FQDN part of the URI is already known, the URI is ignored, 
and the existing peer entry is added to the routing table for the 
specified realm and application ID.