示例#1
0
  @Override
  public org.eris.messaging.Sender createSender(String address, SenderMode mode)
      throws org.eris.messaging.TransportException, org.eris.messaging.SessionException {
    checkPreConditions();
    Sender sender;
    Source source = new Source();
    Target target = new Target();
    if (address == null || address.isEmpty() || address.equals("#")) {
      String temp = UUID.randomUUID().toString();
      sender = _session.sender(temp);
      target.setDynamic(true);
    } else {
      sender = _session.sender(address);
      target.setAddress(address);
    }
    sender.setTarget(target);
    sender.setSource(source);
    sender.setSenderSettleMode(
        mode == SenderMode.AT_MOST_ONCE ? SenderSettleMode.SETTLED : SenderSettleMode.UNSETTLED);
    sender.open();

    SenderImpl senderImpl = new SenderImpl(address, this, sender);
    senderImpl.setDynamicAddress(target.getDynamic());
    _senders.put(sender, senderImpl);
    sender.setContext(senderImpl);
    _conn.write();
    return senderImpl;
  }
示例#2
0
 @Override
 public void onConnectionInit(Event event) {
   Connection conn = event.getConnection();
   Session ssn = conn.session();
   Sender snd = ssn.sender("sender");
   conn.open();
   ssn.open();
   snd.open();
 }