org.apache.activemq.artemis.core.server.management.Notification.getProperties()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(71)

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

Notification.getProperties介绍

暂无

代码示例

代码示例来源:origin: apache/activemq-artemis

@Override
  public void onNotification(final Notification notification) {
   if (!(notification.getType() instanceof CoreNotificationType))
     return;
   // removing the groupid if the binding has been removed
   if (notification.getType() == CoreNotificationType.BINDING_REMOVED) {
     SimpleString clusterName = notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
     List<SimpleString> list = groupMap.remove(clusterName);
     if (list != null) {
      for (SimpleString val : list) {
        if (val != null) {
         responses.remove(val);
        }
      }
     }
   }
  }
}

代码示例来源:origin: apache/activemq-artemis

SimpleString clusterName = notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
  removeGrouping(clusterName);
} else if (notification.getType() == CoreNotificationType.BINDING_ADDED) {
  SimpleString clusterName = notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
  try {
   lock.lock();

代码示例来源:origin: apache/activemq-artemis

@Override
public void onNotification(org.apache.activemq.artemis.core.server.management.Notification notification) {
 if (!(notification.getType() instanceof CoreNotificationType))
   return;
 CoreNotificationType type = (CoreNotificationType) notification.getType();
 TypedProperties prop = notification.getProperties();
 this.broadcaster.sendNotification(new Notification(type.toString(), this, notifSeq.incrementAndGet(), notification.toString()));
}

代码示例来源:origin: apache/activemq-artemis

notificationMessage.setAddress(managementNotificationAddress);
if (notification.getProperties() != null) {
 TypedProperties props = notification.getProperties();
 props.forEach(notificationMessage::putObjectProperty);

代码示例来源:origin: apache/activemq-artemis

TypedProperties props = notification.getProperties();
TypedProperties props = notification.getProperties();
TypedProperties props = notification.getProperties();
TypedProperties props = notification.getProperties();

代码示例来源:origin: apache/activemq-artemis

@Test
public void testNotifications() throws Exception {
 TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<String, Object>(), RandomUtil.randomString());
 TransportConfiguration acceptorConfig2 = new TransportConfiguration(NettyAcceptorFactory.class.getName(), new HashMap<String, Object>(), RandomUtil.randomString());
 Configuration config = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addAcceptorConfiguration(acceptorConfig2);
 ActiveMQServer service = createServer(false, config);
 service.setMBeanServer(mbeanServer);
 service.start();
 AcceptorControl acceptorControl = createManagementControl(acceptorConfig2.getName());
 SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
 service.getManagementService().addNotificationListener(notifListener);
 Assert.assertEquals(0, notifListener.getNotifications().size());
 acceptorControl.stop();
 Assert.assertEquals(usingCore() ? 5 : 1, notifListener.getNotifications().size());
 Notification notif = notifListener.getNotifications().get(usingCore() ? 2 : 0);
 Assert.assertEquals(CoreNotificationType.ACCEPTOR_STOPPED, notif.getType());
 Assert.assertEquals(NettyAcceptorFactory.class.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString());
 acceptorControl.start();
 Assert.assertEquals(usingCore() ? 10 : 2, notifListener.getNotifications().size());
 notif = notifListener.getNotifications().get(usingCore() ? 7 : 1);
 Assert.assertEquals(CoreNotificationType.ACCEPTOR_STARTED, notif.getType());
 Assert.assertEquals(NettyAcceptorFactory.class.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString());
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testNotifications() throws Exception {
 SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
 BridgeControl bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
 server_0.getManagementService().addNotificationListener(notifListener);
 Assert.assertEquals(0, notifListener.getNotifications().size());
 bridgeControl.stop();
 Assert.assertEquals(1, notifListener.getNotifications().size());
 Notification notif = notifListener.getNotifications().get(0);
 Assert.assertEquals(CoreNotificationType.BRIDGE_STOPPED, notif.getType());
 Assert.assertEquals(bridgeControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
 bridgeControl.start();
 Assert.assertEquals(2, notifListener.getNotifications().size());
 notif = notifListener.getNotifications().get(1);
 Assert.assertEquals(CoreNotificationType.BRIDGE_STARTED, notif.getType());
 Assert.assertEquals(bridgeControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testDiscoveryGroupNotifications() throws Exception {
 SimpleNotificationService notifService = new SimpleNotificationService();
 SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
 notifService.addNotificationListener(notifListener);
 final InetAddress groupAddress = InetAddress.getByName(address1);
 final int groupPort = getUDPDiscoveryPort();
 final int timeout = 500;
 dg = newDiscoveryGroup(RandomUtil.randomString(), RandomUtil.randomString(), null, groupAddress, groupPort, timeout, notifService);
 Assert.assertEquals(0, notifListener.getNotifications().size());
 dg.start();
 Assert.assertEquals(1, notifListener.getNotifications().size());
 Notification notif = notifListener.getNotifications().get(0);
 Assert.assertEquals(CoreNotificationType.DISCOVERY_GROUP_STARTED, notif.getType());
 Assert.assertEquals(dg.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
 dg.stop();
 Assert.assertEquals(2, notifListener.getNotifications().size());
 notif = notifListener.getNotifications().get(1);
 Assert.assertEquals(CoreNotificationType.DISCOVERY_GROUP_STOPPED, notif.getType());
 Assert.assertEquals(dg.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
}

代码示例来源:origin: apache/activemq-artemis

@Test
  public void testBroadcastGroupNotifications() throws Exception {
   SimpleNotificationService notifService = new SimpleNotificationService();
   SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
   notifService.addNotificationListener(notifListener);

   final InetAddress groupAddress = InetAddress.getByName(address1);
   final int groupPort = getUDPDiscoveryPort();

   bg = newBroadcast(RandomUtil.randomString(), RandomUtil.randomString(), null, -1, groupAddress, groupPort);

   bg.setNotificationService(notifService);

   Assert.assertEquals(0, notifListener.getNotifications().size());

   bg.start();

   Assert.assertEquals(1, notifListener.getNotifications().size());
   Notification notif = notifListener.getNotifications().get(0);
   Assert.assertEquals(CoreNotificationType.BROADCAST_GROUP_STARTED, notif.getType());
   Assert.assertEquals(bg.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());

   bg.stop();

   Assert.assertEquals(2, notifListener.getNotifications().size());
   notif = notifListener.getNotifications().get(1);
   Assert.assertEquals(CoreNotificationType.BROADCAST_GROUP_STOPPED, notif.getType());
   Assert.assertEquals(bg.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
  }
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testNotifications() throws Exception {
 SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
 checkResource(ObjectNameBuilder.DEFAULT.getClusterConnectionObjectName(clusterConnectionConfig1.getName()));
 ClusterConnectionControl clusterConnectionControl = createManagementControl(clusterConnectionConfig1.getName());
 server_0.getManagementService().addNotificationListener(notifListener);
 Assert.assertEquals(0, notifListener.getNotifications().size());
 clusterConnectionControl.stop();
 Assert.assertTrue(notifListener.getNotifications().size() > 0);
 Notification notif = getFirstNotificationOfType(notifListener.getNotifications(), CoreNotificationType.CLUSTER_CONNECTION_STOPPED);
 Assert.assertNotNull(notif);
 Assert.assertEquals(clusterConnectionControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
 clusterConnectionControl.start();
 Assert.assertTrue(notifListener.getNotifications().size() > 0);
 notif = getFirstNotificationOfType(notifListener.getNotifications(), CoreNotificationType.CLUSTER_CONNECTION_STARTED);
 Assert.assertNotNull(notif);
 Assert.assertEquals(clusterConnectionControl.getName(), notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString());
}

代码示例来源:origin: apache/activemq-artemis

codesAsked.add(notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID));

相关文章

微信公众号

最新文章

更多