org.apache.qpid.proton.engine.Event.getConnection()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.apache.qpid.proton.engine.Event.getConnection()方法的一些代码示例,展示了Event.getConnection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getConnection()方法的具体详情如下:
包路径:org.apache.qpid.proton.engine.Event
类名称:Event
方法名:getConnection

Event.getConnection介绍

暂无

代码示例

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

@Override
public void onConnectionRemoteOpen(Event event) {
  open(event.getConnection());
}

代码示例来源:origin: org.apache.qpid/proton-j

@Override
public void onConnectionRemoteOpen(Event event) {
  open(event.getConnection());
}

代码示例来源:origin: org.apache.qpid/proton-j

@Override
public void onConnectionRemoteClose(Event event) {
  close(event.getConnection());
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

@Override
public void onConnectionRemoteClose(Event event) {
  close(event.getConnection());
}

代码示例来源:origin: Azure/azure-service-bus-java

@Override
public void onConnectionFinal(Event event) {
  TRACE_LOGGER.debug("onConnectionFinal: hostname:{}", event.getConnection().getHostname());
}

代码示例来源:origin: Azure/azure-event-hubs-java

@Override
public void onConnectionRemoteOpen(Event event) {
  if (TRACE_LOGGER.isInfoEnabled()) {
    TRACE_LOGGER.info(String.format(Locale.US, "onConnectionRemoteOpen: hostname[%s], remoteContainer[%s]",
        event.getConnection().getHostname(), event.getConnection().getRemoteContainer()));
  }
  this.amqpConnection.onOpenComplete(null);
}

代码示例来源:origin: Azure/azure-service-bus-java

@Override
public void onConnectionRemoteOpen(Event event)
{        
  TRACE_LOGGER.debug("Connection.onConnectionRemoteOpen: hostname:{}, remotecontainer:{}", event.getConnection().getHostname(), event.getConnection().getRemoteContainer());
  this.messagingFactory.onConnectionOpen();
}

代码示例来源:origin: Azure/azure-event-hubs-java

@Override
public void onConnectionLocalOpen(Event event) {
  final Connection connection = event.getConnection();
  final ErrorCondition error = connection.getCondition();
  if (TRACE_LOGGER.isInfoEnabled()) {
    TRACE_LOGGER.info(String.format(Locale.US, "onConnectionLocalOpen: hostname[%s], errorCondition[%s], errorDescription[%s]",
        connection.getHostname(),
        error != null ? error.getCondition() : "n/a",
        error != null ? error.getDescription() : "n/a"));
  }
}

代码示例来源:origin: Azure/azure-event-hubs-java

@Override
  public void onConnectionFinal(Event event) {
    final Connection connection = event.getConnection();
    final ErrorCondition error = connection.getCondition();

    if (TRACE_LOGGER.isInfoEnabled()) {
      TRACE_LOGGER.info(String.format(Locale.US, "onConnectionFinal: hostname[%s], errorCondition[%s], errorDescription[%s]",
          connection.getHostname(),
          error != null ? error.getCondition() : "n/a",
          error != null ? error.getDescription() : "n/a"));
    }
  }
}

代码示例来源:origin: Azure/azure-event-hubs-java

@Override
  public void onTransportClosed(Event event) {
    final Transport transport = event.getTransport();
    final Connection connection = event.getConnection();

    if (TRACE_LOGGER.isInfoEnabled()) {
      TRACE_LOGGER.info(String.format(Locale.US, "onTransportClosed hostname[%s]",
          (connection != null ? connection.getHostname() : "n/a")));
    }

    if (transport != null && connection != null && connection.getTransport() != null) {
      transport.unbind();
    }
  }
}

代码示例来源:origin: Azure/azure-event-hubs-java

@Override
public void onConnectionUnbound(Event event) {
  final Connection connection = event.getConnection();
  if (TRACE_LOGGER.isInfoEnabled()) {
    TRACE_LOGGER.info(String.format(Locale.US, "onConnectionUnbound: hostname[%s], state[%s], remoteState[%s]",
        connection.getHostname(), connection.getLocalState(), connection.getRemoteState()));
  }
  // if failure happened while establishing transport - nothing to free up.
  if (connection.getRemoteState() != EndpointState.UNINITIALIZED)
    connection.free();
}

代码示例来源:origin: Azure/azure-event-hubs-java

@Override
public void onConnectionRemoteClose(Event event) {
  final Connection connection = event.getConnection();
  final ErrorCondition error = connection.getRemoteCondition();
  if (TRACE_LOGGER.isInfoEnabled()) {
    TRACE_LOGGER.info(String.format(Locale.US, "onConnectionRemoteClose: hostname[%s], errorCondition[%s], errorDescription[%s]",
        connection.getHostname(),
        error != null ? error.getCondition() : "n/a",
        error != null ? error.getDescription() : "n/a"));
  }
  this.amqpConnection.onConnectionError(error);
}

代码示例来源:origin: Azure/azure-event-hubs-java

@Override
public void onTransportClosed(Event event) {
  final Connection connection = event.getConnection();
  final Transport transport = event.getTransport();
  final ErrorCondition condition = transport.getCondition();
  if (TRACE_LOGGER.isInfoEnabled()) {
    TRACE_LOGGER.info(String.format(Locale.US, "onTransportClosed: hostname[%s], error[%s]",
        connection != null ? connection.getHostname() : "n/a", (condition != null ? condition.getDescription() : "n/a")));
  }
  if (connection != null && connection.getRemoteState() != EndpointState.CLOSED) {
    // if the remote-peer abruptly closes the connection without issuing close frame
    // issue one
    this.amqpConnection.onConnectionError(condition);
  }
}

代码示例来源:origin: Azure/azure-service-bus-java

@Override
public void onConnectionBound(Event event)
{
  TRACE_LOGGER.debug("onConnectionBound: hostname:{}", event.getConnection().getHostname());
  Transport transport = event.getTransport();
  
  this.addTransportLayers(event, (TransportInternal) transport);
  Sasl sasl = transport.sasl();
  sasl.setMechanisms("ANONYMOUS");
}

代码示例来源:origin: Azure/azure-service-bus-java

@Override
public void addTransportLayers(final Event event, final TransportInternal transport) {
  super.addTransportLayers(event, transport);
  final ProxyImpl proxy = new ProxyImpl();
  final String hostName = event.getConnection().getHostname();
  final ProxyHandler proxyHandler = new ProxyHandlerImpl();
  final Map<String, String> proxyHeader = getAuthorizationHeader();
  proxy.configure(hostName, proxyHeader, proxyHandler, transport);
  transport.addTransportLayer(proxy);
  if (TRACE_LOGGER.isInfoEnabled()) {
    TRACE_LOGGER.info("addProxyHandshake: hostname[" + hostName + "]");
  }
}

代码示例来源:origin: Azure/azure-event-hubs-java

@Override
protected void addTransportLayers(final Event event, final TransportInternal transport) {
  super.addTransportLayers(event, transport);
  final ProxyImpl proxy = new ProxyImpl();
  // host name used to create proxy connect request
  // after creating the socket to proxy
  final String hostName = event.getConnection().getHostname();
  final ProxyHandler proxyHandler = new ProxyHandlerImpl();
  final Map<String, String> proxyHeader = getAuthorizationHeader();
  proxy.configure(hostName, proxyHeader, proxyHandler, transport);
  transport.addTransportLayer(proxy);
  if (TRACE_LOGGER.isInfoEnabled()) {
    TRACE_LOGGER.info("addProxyHandshake: hostname[" + hostName +"]");
  }
}

代码示例来源:origin: Azure/azure-service-bus-java

@Override
  public void onConnectionLocalClose(Event event) {
    Connection connection = event.getConnection();
    TRACE_LOGGER.debug("onConnectionLocalClose: hostname:{}", connection.getHostname());
    if(connection.getRemoteState() == EndpointState.CLOSED)
    {
      // Service closed it first. In some such cases transport is not unbound and causing a leak.
      if(connection.getTransport() != null)
      {
        connection.getTransport().unbind();
      }
      
      connection.free();
    }
  }
}

代码示例来源:origin: Azure/azure-service-bus-java

@Override
public void onConnectionLocalOpen(Event event)
{
  Connection connection = event.getConnection();
  if (connection.getRemoteState() != EndpointState.UNINITIALIZED)
  {
    return;
  }
  Transport transport = Proton.transport();
  transport.sasl();
  transport.setEmitFlowEventOnSend(false);
  transport.bind(connection);
}

代码示例来源:origin: Azure/azure-service-bus-java

@Override
public void onConnectionRemoteClose(Event event)
{
  final Connection connection = event.getConnection();
  final ErrorCondition error = connection.getRemoteCondition();
  
  TRACE_LOGGER.debug("onConnectionRemoteClose: hostname:{},errorCondition:{}", connection.getHostname(), error != null ? error.getCondition() + "," + error.getDescription() : null);
  boolean shouldFreeConnection = connection.getLocalState() == EndpointState.CLOSED;		
  this.messagingFactory.onConnectionError(error);
  if(shouldFreeConnection)
  {
    connection.free();
  }
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

private void handleOpen(Event event) {
  Connection connection = event.getConnection();
  if (connection.getRemoteState() != EndpointState.UNINITIALIZED) {
    return;
  }
  Transport transport = Proton.transport();
  Sasl sasl = transport.sasl();
  sasl.client();
  sasl.setMechanisms("ANONYMOUS");
  transport.webSocket();
  transport.bind(connection);
}

相关文章