Package org.hornetq.api.core

Examples of org.hornetq.api.core.HornetQException


            // The special user cluster user is used for creating sessions that replicate management operation between
            // nodes
            if (!managementClusterPassword.equals(password))
            {
               throw new HornetQException(HornetQException.SECURITY_EXCEPTION, "Unable to validate user: " + user);
            }
            else
            {
               return;
            }
         }

         if (!securityManager.validateUser(user, password))
         {
            if (notificationService != null)
            {
               TypedProperties props = new TypedProperties();

               props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.toSimpleString(user));

               Notification notification = new Notification(null, SECURITY_AUTHENTICATION_VIOLATION, props);

               notificationService.sendNotification(notification);
            }

            throw new HornetQException(HornetQException.SECURITY_EXCEPTION, "Unable to validate user: " + user);
         }
      }
   }
View Full Code Here


               Notification notification = new Notification(null, NotificationType.SECURITY_PERMISSION_VIOLATION, props);

               notificationService.sendNotification(notification);
            }

            throw new HornetQException(HornetQException.SECURITY_EXCEPTION,
                                       "User: " + session.getUsername() +
                                                " doesn't have permission='" +
                                                checkType +
                                                "' on address " +
                                                saddress);
View Full Code Here

   public synchronized ReplicationEndpoint connectToReplicationEndpoint(final Channel channel) throws Exception
   {
      if (!configuration.isBackup())
      {
         throw new HornetQException(HornetQException.ILLEGAL_STATE, "Connected server is not a backup server");
      }

      if (replicationEndpoint.getChannel() != null)
      {
         throw new HornetQException(HornetQException.ILLEGAL_STATE,
                                    "Backup replication server is already connected to another server");
      }

      replicationEndpoint.setChannel(channel);
View Full Code Here

      Binding binding = postOffice.getBinding(queueName);

      if (binding == null)
      {
         throw new HornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, "No such queue " + queueName);
      }

      Queue queue = (Queue)binding.getBindable();

      if (queue.getPageSubscription() != null)
      {
         queue.getPageSubscription().close();
      }

      if (queue.getConsumerCount() != 0)
      {
         throw new HornetQException(HornetQException.ILLEGAL_STATE, "Cannot delete queue " + queue.getName() +
                                                                    " on binding " +
                                                                    queueName +
                                                                    " - it has consumers = " +
                                                                    binding.getClass().getName());
      }
View Full Code Here

         {
            if (replicationEndpoint == null)
            {
               HornetQServerImpl.log.warn("There is no replication endpoint, can't activate this backup server");

               throw new HornetQException(HornetQException.INTERNAL_ERROR, "Can't activate the server");
            }

            replicationEndpoint.stop();
         }
View Full Code Here

   public void destroyDivert(SimpleString name) throws Exception
   {
      Binding binding = postOffice.getBinding(name);
      if (binding == null)
      {
         throw new HornetQException(HornetQException.INTERNAL_ERROR, "No binding for divert " + name);
      }
      if (!(binding instanceof DivertBinding))
      {
         throw new HornetQException(HornetQException.INTERNAL_ERROR, "Binding " + name + " is not a divert");
      }

      postOffice.removeBinding(name);
   }
View Full Code Here

         {
            return binding.getQueue();
         }
         else
         {
            throw new HornetQException(HornetQException.QUEUE_EXISTS, "Queue " + queueName + " already exists");
         }
      }

      Filter filter = FilterImpl.createFilter(filterString);
View Full Code Here

            }
  
            if (ref == null)
            {
              
               HornetQException e = new HornetQException(HornetQException.ILLEGAL_STATE, "Could not find reference on consumerID=" +
                                id +
                                ", messageId = " +
                                messageID +
                                " queue = " +
                                messageQueue.getName());
               throw e;
            }
  
            ref.getQueue().acknowledge(tx, ref);
         }
         while (ref.getMessage().getMessageID() != messageID);
        
         if (startedTransaction)
         {
            tx.commit();
         }
      }
      catch (HornetQException e)
      {
         if (startedTransaction)
         {
            tx.rollback();
         }
         else
         {
            tx.markAsRollbackOnly(e);
         }
         throw e;
      }
      catch (Throwable e)
      {
         log.error(e.getMessage(), e);
         HornetQException hqex = new HornetQException(HornetQException.ILLEGAL_STATE, e.getMessage());
         if (startedTransaction)
         {
            tx.rollback();
         }
         else
View Full Code Here

      Binding binding = addressManager.removeBinding(uniqueName);

      if (binding == null)
      {
         throw new HornetQException(HornetQException.QUEUE_DOES_NOT_EXIST);
      }

      if (addressManager.getBindingsForRoutingAddress(binding.getAddress()) == null)
      {
         pagingManager.deletePageStore(binding.getAddress());
View Full Code Here

            warnMessage.append(message.toString());
            PostOfficeImpl.log.warn(warnMessage.toString());
           
            if (context.getTransaction() != null)
            {
               context.getTransaction().markAsRollbackOnly(new HornetQException(HornetQException.DUPLICATE_ID_REJECTED, warnMessage.toString()));
            }

            return false;
         }
         else
         {
            if (context.getTransaction() == null)
            {
               context.setTransaction(new TransactionImpl(storageManager));
               startedTX.set(true);
            }
         }

         cacheBridge.addToCache(bridgeDupBytes, context.getTransaction());

         message.removeProperty(MessageImpl.HDR_BRIDGE_DUPLICATE_ID);
      }

      byte[] duplicateIDBytes = message.getDuplicateIDBytes();

      DuplicateIDCache cache = null;

      boolean isDuplicate = false;

      if (duplicateIDBytes != null)
      {
         cache = getDuplicateIDCache(message.getAddress());

         isDuplicate = cache.contains(duplicateIDBytes);

         if (rejectDuplicates && isDuplicate)
         {
            String warnMessage = "Duplicate message detected - message will not be routed. Message information:" + message.toString();
            PostOfficeImpl.log.warn(warnMessage);

            if (context.getTransaction() != null)
            {
               context.getTransaction().markAsRollbackOnly(new HornetQException(HornetQException.DUPLICATE_ID_REJECTED, warnMessage));
            }

            return false;
         }
      }
View Full Code Here

TOP

Related Classes of org.hornetq.api.core.HornetQException

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.