Tabnine Logo
Notification.getMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
getMessage
method
in
javax.management.Notification

Best Java code snippets using javax.management.Notification.getMessage (Showing top 20 results out of 432)

origin: apache/geode

 /**
  * Sends the given notification.
  *
  * @param notif notification to send
  *
  * @throws NullPointerException if resource or ModelMBean for resource is null
  */
 /* default */static void sendNotification(ManagedResource resource, Notification notif) {
  try {
   if (MBeanUtil.isRegistered(resource.getObjectName())) {
    resource.getModelMBean().sendNotification(notif);
    if (logger.isDebugEnabled()) {
     logger.debug("Sent '{}' notification", notif.getType());
    }
   }
  } catch (RuntimeOperationsException e) {
   logger
     .info(String.format("Failed to send %s notification for %s",
       new Object[] {"'" + notif.getType() + "'", "'" + notif.getMessage() + "'"}),
       e);
  } catch (MBeanException e) {
   logger
     .info(String.format("Failed to send %s notification for %s",
       new Object[] {"'" + notif.getType() + "'", "'" + notif.getMessage() + "'"}),
       e);
  }
 }
}
origin: apache/geode

@Override
public void handleNotification(Notification arg0, Object arg1) {
 this.logger.info("Notification: " + arg0 + "; o: " + arg1 + "; m: " + arg0.getMessage());
 this.critical.set(true);
}
origin: apache/geode

notification.getMessage());
origin: spring-projects/spring-batch

  @Test
  public void testRepeatOperationsOpenUsed() throws Exception {
    final List<Notification> list = new ArrayList<>();

    publisher.setNotificationPublisher(new NotificationPublisher() {
      @Override
      public void sendNotification(Notification notification) throws UnableToSendNotificationException {
        list.add(notification);
      }
    });

    publisher.onApplicationEvent(new SimpleMessageApplicationEvent(this, "foo"));
    assertEquals(1, list.size());
    String message = list.get(0).getMessage();
    assertTrue("Message does not contain 'foo': ", message.indexOf("foo") > 0);
  }
}
origin: spring-projects/spring-integration

private void verifyReceipt(PollableChannel channel, String beanName) {
  Message<?> message = channel.receive(1000);
  assertNotNull(message);
  assertEquals(Notification.class, message.getPayload().getClass());
  assertEquals("ABC", ((Notification) message.getPayload()).getMessage());
  assertTrue(((String) ((Notification) message.getPayload()).getSource()).endsWith(beanName));
}
origin: spring-projects/spring-integration

@Test
public void testPublish() {
  publishChannel.send(new GenericMessage<String>("bar"));
  Message<?> message = publishInChannel.receive(100000);
  assertNotNull(message);
  assertTrue(message.getPayload() instanceof Notification);
  Notification notification = (Notification) message.getPayload();
  assertEquals("bar", notification.getMessage());
  assertEquals("foo", notification.getType());
}
origin: spring-projects/spring-integration

@Test
public void simplePublish() {
  MessageHandler handler = context.getBean("testPublisher", MessageHandler.class);
  assertEquals(0, this.listener.notifications.size());
  handler.handleMessage(new GenericMessage<String>("foo"));
  assertEquals(1, this.listener.notifications.size());
  Notification notification = this.listener.notifications.get(0);
  assertEquals(this.publisherObjectName, notification.getSource());
  assertEquals("foo", notification.getMessage());
  assertEquals("test.type", notification.getType());
}
origin: spring-projects/spring-integration

@Test //INT-2275
public void publishStringMessageWithinChain() throws Exception {
  assertNotNull(
      this.beanFactory.getBean(
          "chainWithJmxNotificationPublishing$child."
              + "jmx-notification-publishing-channel-adapter-within-chain.handler",
          MessageHandler.class));
  assertNull(listener.lastNotification);
  Message<?> message = MessageBuilder.withPayload("XYZ")
      .setHeader(JmxHeaders.NOTIFICATION_TYPE, "test.type").build();
  publishingWithinChainChannel.send(message);
  assertNotNull(listener.lastNotification);
  Notification notification = listener.lastNotification;
  assertEquals("XYZ", notification.getMessage());
  assertEquals("test.type", notification.getType());
  assertNull(notification.getUserData());
  Set<ObjectName> names = server
      .queryNames(new ObjectName("*:type=MessageHandler," + "name=\"chainWithJmxNotificationPublishing$child."
          + "jmx-notification-publishing-channel-adapter-within-chain\",*"), null);
  assertEquals(1, names.size());
  names = server
      .queryNames(new ObjectName("*:type=MessageChannel,"
          + "name=org.springframework.integration.test.anon,source=anonymous,*"), null);
  assertEquals(1, names.size());
}
origin: spring-projects/spring-integration

@Test
public void publishUserData() throws Exception {
  assertNull(listener.lastNotification);
  TestData data = new TestData();
  Message<?> message = MessageBuilder.withPayload(data)
      .setHeader(JmxHeaders.NOTIFICATION_TYPE, "test.type").build();
  channel.send(message);
  assertNotNull(listener.lastNotification);
  Notification notification = listener.lastNotification;
  assertNull(notification.getMessage());
  assertEquals(data, notification.getUserData());
  assertEquals("test.type", notification.getType());
}
origin: spring-projects/spring-integration

@Test
public void publishStringMessage() throws Exception {
  adviceCalled = 0;
  assertNull(listener.lastNotification);
  Message<?> message = MessageBuilder.withPayload("XYZ")
      .setHeader(JmxHeaders.NOTIFICATION_TYPE, "test.type").build();
  channel.send(message);
  assertNotNull(listener.lastNotification);
  Notification notification = listener.lastNotification;
  assertEquals("XYZ", notification.getMessage());
  assertEquals("test.type", notification.getType());
  assertNull(notification.getUserData());
  assertEquals(1, adviceCalled);
}
origin: spring-projects/spring-integration

@Test
@SuppressWarnings("serial")
public void notificationWithFilter() {
  QueueChannel outputChannel = new QueueChannel();
  NotificationListeningMessageProducer adapter = new NotificationListeningMessageProducer();
  adapter.setServer(this.server);
  adapter.setObjectName(this.objectName);
  adapter.setOutputChannel(outputChannel);
  adapter.setFilter(notification -> !notification.getMessage().equals("bad"));
  adapter.setBeanFactory(mock(BeanFactory.class));
  adapter.afterPropertiesSet();
  adapter.start();
  adapter.onApplicationEvent(new ContextRefreshedEvent(Mockito.mock(ApplicationContext.class)));
  this.numberHolder.publish("bad");
  Message<?> message = outputChannel.receive(0);
  assertNull(message);
  this.numberHolder.publish("okay");
  message = outputChannel.receive(0);
  assertNotNull(message);
  assertTrue(message.getPayload() instanceof Notification);
  Notification notification = (Notification) message.getPayload();
  assertEquals("okay", notification.getMessage());
}
origin: org.mobicents.protocols.ss7.tools.simulator/simulator-gui

@Override
public void sendNotif(Notification notif) {
  super.sendNotif(notif);
  if (notif.getMessage().startsWith("CurDialog: Rcvd: procUnstrSsReq: ")) {
    String s1 = notif.getMessage().substring(17);
    this.lbMessage.setText(s1);
  }
  if (notif.getMessage().startsWith("CurDialog: Rcvd: unstrSsResp: ")) {
    String s1 = notif.getMessage().substring(17);
    this.lbMessage.setText(s1);
  }
}
origin: spring-projects/spring-integration

@Test
public void simpleNotification() {
  QueueChannel outputChannel = new QueueChannel();
  NotificationListeningMessageProducer adapter = new NotificationListeningMessageProducer();
  adapter.setServer(this.server);
  adapter.setObjectName(this.objectName);
  adapter.setOutputChannel(outputChannel);
  adapter.setBeanFactory(mock(BeanFactory.class));
  adapter.afterPropertiesSet();
  adapter.start();
  adapter.onApplicationEvent(new ContextRefreshedEvent(Mockito.mock(ApplicationContext.class)));
  this.numberHolder.publish("foo");
  Message<?> message = outputChannel.receive(0);
  assertNotNull(message);
  assertTrue(message.getPayload() instanceof Notification);
  Notification notification = (Notification) message.getPayload();
  assertEquals("foo", notification.getMessage());
  assertEquals(objectName, notification.getSource());
  assertNull(message.getHeaders().get(JmxHeaders.NOTIFICATION_HANDBACK));
}
origin: spring-projects/spring-integration

@Test
public void notificationWithHandback() {
  QueueChannel outputChannel = new QueueChannel();
  NotificationListeningMessageProducer adapter = new NotificationListeningMessageProducer();
  adapter.setServer(this.server);
  adapter.setObjectName(this.objectName);
  adapter.setOutputChannel(outputChannel);
  Integer handback = 123;
  adapter.setHandback(handback);
  adapter.setBeanFactory(mock(BeanFactory.class));
  adapter.afterPropertiesSet();
  adapter.start();
  adapter.onApplicationEvent(new ContextRefreshedEvent(Mockito.mock(ApplicationContext.class)));
  this.numberHolder.publish("foo");
  Message<?> message = outputChannel.receive(0);
  assertNotNull(message);
  assertTrue(message.getPayload() instanceof Notification);
  Notification notification = (Notification) message.getPayload();
  assertEquals("foo", notification.getMessage());
  assertEquals(objectName, notification.getSource());
  assertEquals(handback, message.getHeaders().get(JmxHeaders.NOTIFICATION_HANDBACK));
}
origin: io.snappydata/gemfire-hydra-tests

public void handleNotification(Notification arg0, Object arg1) {
 this.logger.info("Notification: " + arg0 + 
   "; o: " + arg1 + 
   "; m: " + arg0.getMessage());
 this.critical.set(true);
}

origin: org.mobicents.protocols.ss7.tools.simulator/simulator-gui

@Override
public void sendNotif(Notification notif) {
  super.sendNotif(notif);
  if (notif.getMessage().startsWith("DlgClosed:")) {
    this.setDialogClosed();
  }
  if (notif.getMessage().startsWith("DlgStarted:") || notif.getMessage().startsWith("DlgAccepted:")) {
    this.setDialogOpened();
  }
}
origin: jiaqi/jmxterm

 @Override
 public void handleNotification(Notification notification, Object handback) {
  Session session = getSession();
  StringBuilder sb = new StringBuilder("notification received: ");
  sb.append("timestamp=").append(notification.getTimeStamp());
  sb.append(",class=").append(notification.getClass().getName());
  sb.append(",source=").append(notification.getSource());
  sb.append(",type=").append(notification.getType());
  sb.append(",message=").append(notification.getMessage());
  session.output.println(sb.toString());
 }
}
origin: org.cyclopsgroup/jmxterm

  @Override
  public void handleNotification(Notification notification, Object handback) {
    Session session = getSession();
    StringBuilder sb = new StringBuilder("notification received: ");
    sb.append("timestamp=").append(notification.getTimeStamp());
    sb.append(",class=").append(notification.getClass().getName());
    sb.append(",source=").append(notification.getSource());
    sb.append(",type=").append(notification.getType());
    sb.append(",message=").append(notification.getMessage());
    session.output.println(sb.toString());
  }
}
origin: org.terracotta/terracotta-l1

public void broadcastLogEvent(final String event, final String[] throwableStringRep) {
 Notification notif = new Notification(LOGGING_EVENT_TYPE, this, sequenceNumber.incrementAndGet(),
                       System.currentTimeMillis(), event);
 notif.setUserData(throwableStringRep);
 sendNotification(notif);
 notif = new Notification(notif.getType(), getClass().getName(), notif.getSequenceNumber(), notif.getTimeStamp(),
              notif.getMessage());
 notif.setUserData(throwableStringRep);
 tcLoggingHistoryProvider.push(notif);
}
origin: mx4j/mx4j-tools

protected void onSerialize(SerializationContext context, Notification notification) throws IOException
{
 context.serialize(CLASS_NAME_QNAME, null, notification.getType());
 context.serialize(SOURCE_QNAME, null, notification.getSource());
 context.serialize(SEQUENCE_NUMBER_QNAME, null, new Long(notification.getSequenceNumber()));
 context.serialize(TIMESTAMP_QNAME, null, new Long(notification.getTimeStamp()));
 context.serialize(MESSAGE_QNAME, null, notification.getMessage());
 context.serialize(USER_DATA_QNAME, null, notification.getUserData());
}
javax.managementNotificationgetMessage

Popular methods of Notification

  • getType
  • <init>
  • getUserData
  • setUserData
  • getSource
  • getTimeStamp
  • getSequenceNumber
  • setSource
  • toString
  • setSequenceNumber
  • getAttachments
  • getClass
  • getAttachments,
  • getClass,
  • getFlag,
  • getIntent,
  • getTitle,
  • setCreatedd_time,
  • setId,
  • setLatestEventInfo,
  • setLink

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now