@Override protected void setUp() throws Exception { System.setProperty("brokername", "testbroker"); brokerService = createBroker(); broker = brokerService.getBroker(); // started automatically // brokerService.start(); context = new ConnectionContext(); context.setBroker(broker); info = new ConnectionInfo(); info.setClientId("James"); info.setUserName("James"); info.setConnectionId(new ConnectionId("1234")); try { broker.addConnection(context, info); } catch (Throwable e) { e.printStackTrace(); fail(e.getMessage()); } assertNotNull("No broker created!"); }
private void discardExpiredMessage(MessageReference reference) { LOG.debug("Discarding expired message {}", reference); if (broker.isExpired(reference)) { ConnectionContext context = new ConnectionContext(new NonCachedMessageEvaluationContext()); context.setBroker(broker); ((Destination) reference.getRegionDestination()) .messageExpired(context, null, new IndirectMessageReference(reference.getMessage())); } }