Examples of OutboundMessage


Examples of org.smslib.OutboundMessage

    gateway.startGateway();
   
    gateways.add(gateway);
   
    ARouter router=new DefaultRouter();
    OutboundMessage message=new OutboundMessage("77374847", "test");
    message.setGatewayId("G1");
   
    Collection<AGateway> candidates= router.route(message, gateways);
    Assert.assertEquals("One gateway for message routing is expected.", 1, candidates.size());
   
    Assert.assertEquals("Message should be routed through G1 gateway.",candidates.contains(gateways.get(0)),true);
View Full Code Here

Examples of org.smslib.OutboundMessage

    //gateway.startGateway();
   
    gateways.add(gateway);
   
    ARouter router=new DefaultRouter();
    OutboundMessage message=new OutboundMessage("77374847", "test");
   
   
    Collection<AGateway> candidates= router.route(message, gateways);
    Assert.assertEquals("Two gateways for message routing are expected.", 2, candidates.size());
   
View Full Code Here

Examples of org.smslib.OutboundMessage

public class SendMessage
{
  public void doIt() throws Exception
  {
    OutboundMessage msg;
    OutboundNotification outboundNotification = new OutboundNotification();
    System.out.println("Example: Send message from Clickatell HTTP Interface.");
    System.out.println(Library.getLibraryDescription());
    System.out.println("Version: " + Library.getLibraryVersion());
    ClickatellHTTPGateway gateway = new ClickatellHTTPGateway("clickatell.http.1", "api_id", "username", "password");
    gateway.setOutbound(true);
    Service.getInstance().setOutboundMessageNotification(outboundNotification);
    // Do we need secure (https) communication?
    // True uses "https", false uses "http" - default is false.
    gateway.setSecure(true);
    Service.getInstance().addGateway(gateway);
    Service.getInstance().startService();
    // Create a message.
    msg = new OutboundMessage("+306948494037", "Hello from SMSLib (Clickatell handler)");
    //msg.setFrom("SMSLIB.ORG");
    // Ask for coverage.
    System.out.println("Is recipient's network covered? : " + gateway.queryCoverage(msg));
    // Send the message.
    Service.getInstance().sendMessage(msg);
View Full Code Here

Examples of org.smslib.OutboundMessage

    Service.getInstance().setInboundMessageNotification(new InboundNotification());
    Service.getInstance().setGatewayStatusNotification(new GatewayStatusNotification());
    Service.getInstance().setOutboundMessageNotification(new OutboundNotification());
    Service.getInstance().startService();
    // Send a message.
    OutboundMessage msg = new OutboundMessage("+967712831950", "Hello from SMSLib and JSMPP");
    // Request Delivery Report
    msg.setStatusReport(true);
    Service.getInstance().sendMessage(msg);
    System.out.println(msg);
    System.out.println("Now Sleeping - Hit <enter> to terminate.");
    System.in.read();
    Service.getInstance().stopService();
View Full Code Here

Examples of org.smslib.OutboundMessage

{
  public void doIt() throws Exception
  {
    GatewayStatusNotification statusNotification = new GatewayStatusNotification();
    OutboundNotification outboundNotification = new OutboundNotification();
    OutboundMessage msg;
    System.out.println("Example: Send messages through SMPP using JSMPP.");
    System.out.println(Library.getLibraryDescription());
    System.out.println("Version: " + Library.getLibraryVersion());
    JSMPPGateway gateway = new JSMPPGateway("smppcon", "localhost", 2715, new BindAttributes("smppclient1", "password", "cp", BindType.TRANSMITTER));
    Service.getInstance().addGateway(gateway);
    Service.getInstance().setGatewayStatusNotification(statusNotification);
    Service.getInstance().setOutboundMessageNotification(outboundNotification);
    Service.getInstance().startService();
    // Send a message.
    msg = new OutboundMessage("+967712831950", "Hello from SMSLib and JSMPP");
    Service.getInstance().sendMessage(msg);
    System.out.println(msg);
    System.out.println("Now Sleeping - Hit <enter> to terminate.");
    System.in.read();
    Service.getInstance().stopService();
View Full Code Here

Examples of org.smslib.OutboundMessage

    gateways.add(new GatewayMock("G1"))
    gateways.add(new GatewayMock("G2"));
    gateways.add(new GatewayMock("G3"));
   
    RoundRobinLoadBalancer balancer = new RoundRobinLoadBalancer();
    OutboundMessage message=new OutboundMessage("77374847", "test");
   
    Assert.assertEquals("Wrong gateway returned by balancer. G1 was expected.", balancer.balance(message, gateways),gateways.get(0));
    Assert.assertEquals("Wrong gateway returned by balancer. G2 was expected.", balancer.balance(message, gateways),gateways.get(1));
    Assert.assertEquals("Wrong gateway returned by balancer. G3 was expected.", balancer.balance(message, gateways),gateways.get(2));
   
View Full Code Here

Examples of org.smslib.OutboundMessage

  public void doIt() throws Exception
  {
    try
    {
      OutboundMessage msg;
      System.out.println("Example: Send message from ExTexting HTTP Interface.");
      System.out.println(Library.getLibraryDescription());
      System.out.println("Version: " + Library.getLibraryVersion());
      EzTextingHTTPGateway gateway = new EzTextingHTTPGateway("eztexting.http.1", "username", "password");
      gateway.setOutbound(true);
      Service.getInstance().addGateway(gateway);
      Service.getInstance().startService();                     
      // Query the service to find out our credit balance.
      System.out.println("Remaining credit: " + gateway.queryBalance());
      // Send a message synchronously.
      msg = new OutboundMessage("0123456789", "Hello from SMSLib (EzTexting handler)");             
      Service.getInstance().sendMessage(msg);     
      System.out.println(msg);
      System.out.println("Now Sleeping - Hit <enter> to terminate.");     
      System.in.read();   
      Service.getInstance().stopService();
View Full Code Here

Examples of org.smslib.OutboundMessage

  @Override
  public OutboundMessage pollDelayedMessage()
  {
    try
    {
      OutboundMessage message = delayQueue.take().getMessage();
      deleteDelayedMessage(message.getUuid());
      return message;
    }
    catch (InterruptedException e)
    {
      //ignored
View Full Code Here

Examples of org.smslib.OutboundMessage

  @Override
  public OutboundMessage pollPendingMessage(String gatewayId)
  {
    PriorityBlockingQueue<OutboundMessage> queue = queueMap.get(gatewayId);
    if (queue == null) return null;
    OutboundMessage message = queue.poll();
    if (message != null) deletePendingMessage(gatewayId, message.getUuid());
    return message;
  }
View Full Code Here

Examples of org.smslib.OutboundMessage

    {
      Logger.getInstance().logError("File of queued message doesn't exist "+fromFile.getPath(), null, null);
      return null;
    }
    ObjectInputStream in = null;
    OutboundMessage message = null;
    try
    {
      in = new ObjectInputStream(new FileInputStream(fromFile));
      message = (OutboundMessage) in.readObject();
      in.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.