private void doBindingRemoved(final ClientMessage message) throws Exception { if (logger.isTraceEnabled()) { logger.trace(ClusterConnectionImpl.this + " Removing binding " + message); } if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { throw new IllegalStateException("clusterName is null"); } SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME); removeBinding(clusterName); }
@Override public synchronized void onMessage(final ClientMessage message) { if (logger.isDebugEnabled()) { logger.debug("ClusterCommunication::Flow record on " + clusterConnector + " Receiving message " + message); } try { // Reset the bindings if (message.containsProperty(PostOfficeImpl.HDR_RESET_QUEUE_DATA)) { reset = true; return; } else if (message.containsProperty(PostOfficeImpl.HDR_RESET_QUEUE_DATA_COMPLETE)) { clearDisconnectedBindings(); return; } if (!reset) { logger.debug("Notification being ignored since first reset wasn't received yet: " + message); return; } handleNotificationMessage(message); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorHandlingMessage(e); } }
private synchronized void doUnProposalReceived(final ClientMessage message) throws Exception { if (!message.containsProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID)) { throw new IllegalStateException("proposal type is null"); } SimpleString groupId = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID); SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE); Integer hops = message.getIntProperty(ManagementHelper.HDR_DISTANCE); if (server.getGroupingHandler() == null) { throw new IllegalStateException("grouping handler is null"); } server.getGroupingHandler().remove(groupId, clusterName, hops + 1); }
logger.trace(ClusterConnectionImpl.this + " Adding binding " + message); if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) { throw new IllegalStateException("distance is null"); if (!message.containsProperty(ManagementHelper.HDR_ADDRESS)) { throw new IllegalStateException("queueAddress is null"); if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { throw new IllegalStateException("clusterName is null"); if (!message.containsProperty(ManagementHelper.HDR_ROUTING_NAME)) { throw new IllegalStateException("routingName is null"); if (!message.containsProperty(ManagementHelper.HDR_BINDING_ID)) { throw new IllegalStateException("queueID is null");
private synchronized void doProposalReceived(final ClientMessage message) throws Exception { if (!message.containsProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID)) { throw new IllegalStateException("proposal type is null"); } SimpleString type = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID); SimpleString val = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE); Integer hops = message.getIntProperty(ManagementHelper.HDR_DISTANCE); if (server.getGroupingHandler() == null) { throw new IllegalStateException("grouping handler is null"); } Response response = server.getGroupingHandler().receive(new Proposal(type, val), hops + 1); if (response != null) { server.getGroupingHandler().sendProposalResponse(response, 0); } }
private synchronized void doProposalResponseReceived(final ClientMessage message) throws Exception { if (!message.containsProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID)) { throw new IllegalStateException("proposal type is null"); } SimpleString type = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID); SimpleString val = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE); SimpleString alt = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_ALT_VALUE); Integer hops = message.getIntProperty(ManagementHelper.HDR_DISTANCE); Response response = new Response(type, val, alt); if (server.getGroupingHandler() == null) { throw new IllegalStateException("grouping handler is null while sending response " + response); } server.getGroupingHandler().proposed(response); server.getGroupingHandler().sendProposalResponse(response, hops + 1); }
logger.trace(ClusterConnectionImpl.this + " Consumer created " + message); if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) { throw new IllegalStateException("distance is null"); if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { throw new IllegalStateException("clusterName is null");
logger.trace(ClusterConnectionImpl.this + " Consumer closed " + message); if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) { throw new IllegalStateException("distance is null"); if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { throw new IllegalStateException("clusterName is null");
private void receiveMessages() throws Exception { ClientSession session = sf.createSession(true, true); session.start(); try (ClientConsumer consumer = session.createConsumer(ADDRESS)) { for (int i = 0; i < numMessages; i++) { ClientMessage message = consumer.receive(100); assertNotNull("Expecting a message " + i, message); assertMessageBody(i, message); assertEquals(i, message.getIntProperty("int").intValue()); assertEquals((short) i, message.getShortProperty("short").shortValue()); assertEquals((byte) i, message.getByteProperty("byte").byteValue()); assertEquals(floatValue(i), message.getFloatProperty("float").floatValue(), 0.001); assertEquals(new SimpleString(Integer.toString(i)), message.getSimpleStringProperty(SIMPLE_STRING_KEY.toString())); assertEqualsByteArrays(byteArray(i), message.getBytesProperty("byte[]")); assertTrue(message.containsProperty("null-value")); assertEquals(message.getObjectProperty("null-value"), null); message.acknowledge(); } assertNull("no more messages", consumer.receive(50)); } session.commit(); }
Assert.assertFalse(message.containsProperty("b")); Assert.assertEquals(3, message.getIntProperty("c").intValue()); Assert.assertEquals(4, message.getIntProperty("d").intValue());
Assert.assertFalse(message.containsProperty("b")); Assert.assertEquals(3, message.getIntProperty("c").intValue()); Assert.assertEquals(4, message.getIntProperty("d").intValue());
assertFalse(message.containsProperty(Message.HDR_ROUTE_TO_IDS));