Package org.apache.cloudstack.framework.messagebus

Examples of org.apache.cloudstack.framework.messagebus.MessageSubscriber


 
  @Inject MessageBus _messageBus;

  @Test
  public void testExactSubjectMatch() {
    _messageBus.subscribe("Host", new MessageSubscriber() {

      @Override
      public void onPublishMessage(String senderAddress, String subject, Object args) {
        Assert.assertEquals(subject, "Host");
      }
View Full Code Here


    _messageBus.clearAll();
  }

  @Test
  public void testRootSubjectMatch() {
    _messageBus.subscribe("/", new MessageSubscriber() {

      @Override
      public void onPublishMessage(String senderAddress, String subject, Object args) {
        Assert.assertTrue(subject.equals("Host") || subject.equals("VM"));
      }
View Full Code Here

    _messageBus.clearAll();
  }
 
  @Test
  public void testMiscMatch() {
    MessageSubscriber subscriberAtParentLevel = new MessageSubscriber() {
      @Override
      public void onPublishMessage(String senderAddress, String subject, Object args) {
        Assert.assertTrue(subject.startsWith(("Host")) || subject.startsWith("VM"));
      }
    };
   
    MessageSubscriber subscriberAtChildLevel = new MessageSubscriber() {
      @Override
      public void onPublishMessage(String senderAddress, String subject, Object args) {
        Assert.assertTrue(subject.equals("Host.123"));
      }
    };
View Full Code Here

    @Override
    public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
        _agentMgr.registerForHostEvents(this, true, false, true);
        VirtualMachine.State.getStateMachine().registerListener(this);
        _messageBus.subscribe("VM_ReservedCapacity_Free", new MessageSubscriber() {
            @Override
            public void onPublishMessage(String senderAddress, String subject, Object obj) {
                VMInstanceVO vm = ((VMInstanceVO) obj);
                s_logger.debug("MessageBus message: host reserved capacity released for VM: " + vm.getLastHostId()
                        + ", checking if host reservation can be released for host:" + vm.getLastHostId());
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.framework.messagebus.MessageSubscriber

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.