/** * Adds a new transport connector for the given TransportServer transport * * @return the newly created and added transport connector * @throws Exception */ public TransportConnector addConnector(TransportServer transport) throws Exception { return addConnector(new TransportConnector(transport)); }
@Override public void setBrokerService(BrokerService brokerService) { this.brokerService = brokerService; this.localBrokerId = brokerService.getRegionBroker().getBrokerId(); localBrokerPath[0] = localBrokerId; }
@Override public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception { next.forgetTransaction(context, transactionId); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].forgetTransaction(context, transactionId); } }
private void startActiveMqBroker() throws Exception { this.activeMQBroker = new BrokerService(); this.activeMQBroker.addConnector("stomp://localhost:" + this.port); this.activeMQBroker.setStartAsync(false); this.activeMQBroker.setPersistent(false); this.activeMQBroker.setUseJmx(false); this.activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5); this.activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5); this.activeMQBroker.start(); }
@Override public void updateClientClusterInfo() { if (isRebalanceClusterClients() || isUpdateClusterClients()) { ConnectionControl control = getConnectionControl(); for (Connection c : this.connections) { c.updateClient(control); if (isRebalanceClusterClients()) { control = getConnectionControl(); } } } }
/** * Overriding removeConnection to make sure the security context is cleaned. */ @Override public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception { super.removeConnection(context, info, error); context.setSecurityContext(null); }
@Override public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception { next.commitTransaction(context, xid, onePhase); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].commitTransaction(context, xid, onePhase); } }
@Override public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { next.addConnection(context, info); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].addConnection(context, info); } }
@Override public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception { next.send(producerExchange, messageSend); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].send(producerExchange, messageSend); } }
@Override public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception { next.beginTransaction(context, xid); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].beginTransaction(context, xid); } }
@Override public void stop() throws Exception { next.stop(); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].stop(); } }
@Override public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception { next.addProducer(context, info); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].addProducer(context, info); } }
@Override public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception { next.acknowledge(consumerExchange, ack); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].acknowledge(consumerExchange, ack); } }
@Override public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { Subscription answer = next.addConsumer(context, info); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].addConsumer(context, info); } return answer; }
@Override public void addSession(ConnectionContext context, SessionInfo info) throws Exception { next.addSession(context, info); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].addSession(context, info); } }
@Override public void removeSession(ConnectionContext context, SessionInfo info) throws Exception { next.removeSession(context, info); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].removeSession(context, info); } }
@Override public void gc() { next.gc(); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].gc(); } }
@Override public void addBroker(Connection connection, BrokerInfo info) { next.addBroker(connection, info); Broker brokers[] = getListeners(); for (int i = 0; i < brokers.length; i++) { brokers[i].addBroker(connection, info); } }
@Override public void virtualDestinationRemoved(ConnectionContext context, VirtualDestination virtualDestination) { getNext().virtualDestinationRemoved(context, virtualDestination); }