oracle.panama.messaging.push
Class Push
java.lang.Object
oracle.panama.messaging.push.PushClientBase
oracle.panama.messaging.push.Push
- public class Push
- extends PushClientBase
A client of Push Server, which sends out messages to Push Server and queries delivery status from Push Server.
Push Server may be configured in two ways:
1. Public Push gateway: Push gateway provides messaging services to Internet/intranet users. The communication between Push client and Push gateway is powered by SOAP technology. Push client must have the URL of Push gateway. It must provide a valid username/password combination to get services, if the gateway asks so.
For example: Push myPushClient = new Push("http://messenger.oracle.com/push/webservices", "user","passwd");
2. Private Local Push Server: Push client and Push server are running on the same machine. Push client calls Push server class through java methods call directly without using SOAP or RPC. No SOAP gateway or authentication is needed for local installation. Push Server provides services to that Push client only. When constructing Push client for local Push server, pass 'null' as Push messaging gateway URL in the constructor. Access to Push Server is granted to local Push client automatically. It's a good idea to provide a user name for logging and reporting purpose, though it's not required.
For example: Push myPushClient = new Push(null, "user",null);
All APIs are identical for local and SOAP Push gateway.
Sending messages to a HTTPS PushServer
PushAPI supports both Oracle SSL and SUN's JSSE. No code change is needed. The classpath is different in these two cases however.
Use Oracle SSL: Oracle SSL uses native code to get high performance.
1. Make sure jssl-1_2.jar and javax-ssl-1_2.jar are inside classpath and NONE of JSSE jars is in classpath.
2a. On Windows system, make sure njssl9.dll is in path.
2b. On Solaris system, make sure libnjssl9.so is in library path.
Use SUN's JSSE
JSSE is a pure Java implementation of SSL, which could be downloaded from SUN. (Not included in this release.)
Add jsse.jar, jcert.jar and jnet.jar into classpath. Make sure jssl-1_2.jar and javax-ssl-1_2.jar are NOT in classpath.
The following example sends out 'hello world' message to two recipients :
1. Send a SMS or Voice msg to 1-650-5551111. If fails, send an email or voice to Mike of Oracle. 2. Send an email, SMS or Fax to jerry.lee of portal.
// recipient(s)
AddressData to[] = new AddressData[2];
// Packet object
Packet pkt = new Packet();
// FROM
DeviceAddressData from = new PhoneAddressData("1-650-1234567");
pkt.setFrom("SMS",from);
pkt.setFrom("Voice",from);
UserAddressData fromUser = new UserAddressData("wireless", "bob");
pkt.setFromUser(fromUser);
// REPLY TO
DeviceAddressData replyTo = new PhoneAddressData("1-650-5067000");
pkt.setReplyTo("SMS",replyTo);
pkt.setReplyTo("Voice",replyTo);
pkt.setReplyToUser(fromUser);
// TO
to[0] = new PhoneAddressData("1-650-5551111");
to[0].setPrimaryTransportType("SMS");
String failoverTypes[] = {"Voice"};
to[0].setFailoverTransportTypes(failoverTypes);
UserAddressData mike = new UserAddressData("oracle","mike");
mike.setPrimaryTransportType("Email");
mike.setFailoverTransportTypes(failoverTypes);
to[0].setFailoverAddress(mike);
UserAddressData jerry = new UserAddressData("portal","jerry.lee");
jerry.setPrimaryTransportType("Email");
String failto[] = new String[2];
failto[0] = "SMS";
failto[1] = "Fax";
jerry.setFailoverTransportTypes(failto);
to[1] = jerry;
pkt.addRecipients(to);
Message msg = new Message();
msg.setContent("hello world!");
msg.setContentType("text/plain");
msg.setSubject(" msg subject");
pkt.setMessage(msg);
sendPacket(pkt);
Push ps = new Push("http://messenger.oracle.com/push/webservices","user","password");
WorkOrder wo[] = null;
try
{
wo = ps.sendMsg( pkt);
}
catch(PushException e)
{
System.out.println("**** PushException caught ");
e.printStackTrace();
}
catch(Exception e)
{
System.out.println("**** Exception caught ");
e.printStackTrace();
}
if(wo != null)
{
System.out.println("\nMessage ID returned from Push Server, transport and address:");
for(int i=0;i<wo.length;i++)
System.out.println(wo[i].getMessageID() + ", " + wo[i].getTransport() + ", " + wo[i].getAddress().getAddress() );
Status status[] = ps.getStatuses(null, null, null, wo);
if(status != null)
{
System.out.println("\nStatus of Message ID:");
for(int i=0;i<status.length;i++)
System.out.println(status[i].getMessageID() + ", \"" + status[i].getContent() +"\"");
}
}
else
System.out.println("No WorkOrder returned.");
}
- See Also:
PushLite
Constructor Summary |
Push(java.lang.String messagingGatewayURL, java.lang.String username, java.lang.String password)
Construct a new Push client instance for an OracleMobile SOAP Messaging push gateway or local Push Server. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VERSION_902
public static final java.lang.String VERSION_902
-
- See Also:
- Constant Field Values
VERSION_9040
public static final java.lang.String VERSION_9040
-
- See Also:
- Constant Field Values
VERSION_904TSA
public static final java.lang.String VERSION_904TSA
-
- See Also:
- Constant Field Values
Push
public Push(java.lang.String messagingGatewayURL,
java.lang.String username,
java.lang.String password)
throws PushException
- Construct a new Push client instance for an OracleMobile SOAP Messaging push gateway or local Push Server.
- Parameters:
messagingGatewayURL
- Complete URL of OracleMobile Push messaging gateway(SOAP). For example: "http://messenger.oracle.com/push/webservices"
null for local Push server.
username
- username of OracleMobile messaging gateway or local Push Server. null if no username is needed.
password
- password of OracleMobile messaging gateway. null if no password is needed.
getAddressString
public java.lang.String getAddressString(AddressData recipient)
- Get the failover chain for the given recipient and content
getStatus
public Status getStatus(WorkOrder workOrder)
throws PushException
- Deprecated. Use XMSSender#getStatus instead
- Get current status of a work order. One work order has one address and the message ID of that address.
Status object returned from this call may be chained if the recipient has failover address(es).
For example: a recipient has failover addresses in following order: 1-222-333333 (SMS), 1-333-444444 (Fax), 1-444-5551234 (voice) and foo@bar.com (Email) Suppose first two attempts fail and msg gets delivered to 3rd address. Status chain may have 3 nodes.
-
- Throws:
PushException
- See Also:
Status
getStatus
public Status[] getStatus(WorkOrder[] workOrders)
throws PushException
- Deprecated. Use oracle.panama.messaging.xms.XMSSender#getStatus instead
- Get current statuses of a set of work orders. Each Status object in the array may have a failover status chain.
-
- Throws:
PushException
- See Also:
getStatus(WorkOrder)
removeStatusListener
public void removeStatusListener()
throws PushException
- 1. unregisters status listener URL from server. 2. stop HTTP status listener running locally
-
- Overrides:
removeStatusListener
in class PushClientBase
-
- Throws:
PushException
send
public WorkOrder[] send(Packet pkt)
throws PushException
- Deprecated. New applications should use sendMsg(Packet)
- Send out message. This method doesn't support failover. sendMsg() is a superset of send(). send() keeps backward compatible with earlier versions.
-
- Parameters:
pkt
- The message packet to be delivered.
- Returns:
- a set of WorkOrders will be returned after Push server accepts the request. One WorkOrder for each instance of recipient's address. The order of WorkOrders may be NOT the same as the order of recipients being added into the Packet by calling Packet.addRecipients().
- Throws:
PushException
- See Also:
sendMsg(Packet)
sendMsg
public WorkOrder[] sendMsg(Packet pkt)
throws PushException
- Deprecated. Use XMSSender#sendMsg instead
- This method is based on send() with supports of failover capability and username capability.
User name capability means that the sender can specify a username (instead of physical address of a recipient) and preferred delivery types to send out a message. Sender and reply to addresses can be existing users too.
For example: send an email to user 'michael' from user 'richard'. That user name must be registered and the specified device must be available in that user's profile.
Failover means that each recipient may have an "address chain". Each node of the chain has one address (i.e. a user name, an email address, a phone number or a WAP push subscriber ID) and a list of preferred transport types (primary transport type and failover transport types) of that address. PushServer will try every address and every transport type of that address from the head of the chain until (1) message has been delivered to an address by a transport type of that address or (2) all addresses and their transport types have been tried.
If a physical address (i.e. phone number, email address or WAP push subscriber ID) is given, it will be used directly. If a username is given, PushServer will find physical addresses from user's profile.
Device failover example: Send a message to Michael's cell phone # 1-234-1234567 via SMS or voice, if both fail, send a voice message to his work number 1-222-3456789. If fails, send an email to his manager's email address paul@company.com
User failover example: contact Michael via SMS, Voice or email. If can't get him, Send a voice or email message to his manager, Paul.
Same address failover:
Failover could happen within same user or same physical device from a transport types (delivery types) to another different transport type in the transport type order specified.
For example: send a SMS to phone number 1-234-5551234, if failed, try voice.
It could happen to a user too. For example: send a voice msg to Sam's work phone, if failed, try his cell phone and pager.
Failover to another address:
If all transport types (delivery types) of an address have been tried and failed and another address is specified as its failover address, the second address is used in further attempts.
A user may fail to another user or a physical address. A physical address may fail to anther physical address or a user.
The maximum number of failover devices is limited to 4. A failover device means a physical address (user name will be converted to physical address by the server) and a transport type combination. If more failover address or transport types have been specified than maximum failover devices, only the first maximum devices are considered. Rest will not be used.
Please see Packet and AddressData classes for more details on how to define failover transport types and failover address.
-
- Parameters:
pkt
- The message packet to be delivered.
- Returns:
- a set of WorkOrders will be returned after Push server accepts the request. One WorkOrder for each instance of recipient's address. The order of WorkOrders may be NOT the same as the order of recipients being added into the Packet by calling Packet.addRecipients().
- Throws:
PushException
- See Also:
send(Packet)
Copyright © 2004 Oracle Corporation. All Rights Reserved.