public void createQueue( final SimpleString address, final SimpleString name, final SimpleString filterString, final boolean temporary, final boolean durable) throws Exception { if (durable) { // make sure the user has privileges to create this queue securityStore.check(address, CheckType.CREATE_DURABLE_QUEUE, this); } else { securityStore.check(address, CheckType.CREATE_NON_DURABLE_QUEUE, this); } Queue queue = server.createQueue(address, name, filterString, durable, temporary); if (temporary) { // Temporary queue in core simply means the queue will be deleted if // the remoting connection // dies. It does not mean it will get deleted automatically when the // session is closed. // It is up to the user to delete the queue when finished with it TempQueueCleanerUpper cleaner = new TempQueueCleanerUpper(postOffice, name, queue); remotingConnection.addCloseListener(cleaner); remotingConnection.addFailureListener(cleaner); tempQueueCleannerUppers.put(name, cleaner); } }
public void createQueue( final SimpleString address, final SimpleString name, final SimpleString filterString, final boolean temporary, final boolean durable) throws Exception { if (durable) { // make sure the user has privileges to create this queue securityStore.check(address, CheckType.CREATE_DURABLE_QUEUE, this); } else { securityStore.check(address, CheckType.CREATE_NON_DURABLE_QUEUE, this); } Queue queue = server.createQueue(address, name, filterString, durable, temporary); if (temporary) { // Temporary queue in core simply means the queue will be deleted if // the remoting connection // dies. It does not mean it will get deleted automatically when the // session is closed. // It is up to the user to delete the queue when finished with it TempQueueCleanerUpper cleaner = new TempQueueCleanerUpper(server, name); remotingConnection.addCloseListener(cleaner); remotingConnection.addFailureListener(cleaner); tempQueueCleannerUppers.put(name, cleaner); } if (HornetQServerLogger.LOGGER.isDebugEnabled()) { HornetQServerLogger.LOGGER.debug( "Queue " + name + " created on address " + name + " with filter=" + filterString + " temporary = " + temporary + " durable=" + durable + " on session user="******", connection=" + this.remotingConnection); } }
private void doSend(final ServerMessage msg, final boolean direct) throws Exception { // check the user has write access to this address. try { securityStore.check(msg.getAddress(), CheckType.SEND, this); } catch (HornetQException e) { if (!autoCommitSends) { tx.markAsRollbackOnly(e); } throw e; } if (tx == null || autoCommitSends) { } else { routingContext.setTransaction(tx); } postOffice.route(msg, routingContext, direct); Pair<UUID, AtomicLong> value = targetAddressInfos.get(msg.getAddress()); if (value == null) { targetAddressInfos.put( msg.getAddress(), new Pair<UUID, AtomicLong>(msg.getUserID(), new AtomicLong(1))); } else { value.setA(msg.getUserID()); value.getB().incrementAndGet(); } routingContext.clear(); }
public void createConsumer( final long consumerID, final SimpleString queueName, final SimpleString filterString, final boolean browseOnly) throws Exception { Binding binding = postOffice.getBinding(queueName); if (binding == null || binding.getType() != BindingType.LOCAL_QUEUE) { throw HornetQMessageBundle.BUNDLE.noSuchQueue(queueName); } securityStore.check(binding.getAddress(), CheckType.CONSUME, this); Filter filter = FilterImpl.createFilter(filterString); ServerConsumer consumer = new ServerConsumerImpl( consumerID, this, (QueueBinding) binding, filter, started, browseOnly, storageManager, callback, preAcknowledge, strictUpdateDeliveryCount, managementService); consumers.put(consumer.getID(), consumer); if (!browseOnly) { TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress()); props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName()); props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName()); props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance()); Queue theQueue = (Queue) binding.getBindable(); props.putIntProperty(ManagementHelper.HDR_CONSUMER_COUNT, theQueue.getConsumerCount()); if (filterString != null) { props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filterString); } Notification notification = new Notification(null, CONSUMER_CREATED, props); managementService.sendNotification(notification); } }
@Override public void createSharedQueue( final SimpleString address, final SimpleString name, boolean durable, final SimpleString filterString) throws Exception { securityStore.check(address, CheckType.CREATE_NON_DURABLE_QUEUE, this); server.createSharedQueue(address, name, filterString, durable); }
private void handleManagementMessage(final ServerMessage message, final boolean direct) throws Exception { try { securityStore.check(message.getAddress(), CheckType.MANAGE, this); } catch (HornetQException e) { if (!autoCommitSends) { tx.markAsRollbackOnly(e); } throw e; } ServerMessage reply = managementService.handleMessage(message); SimpleString replyTo = message.getSimpleStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME); if (replyTo != null) { reply.setAddress(replyTo); doSend(reply, direct); } }
public void createConsumer( final long consumerID, final SimpleString queueName, final SimpleString filterString, final boolean browseOnly, final boolean supportLargeMessage, final Integer credits) throws Exception { Binding binding = postOffice.getBinding(queueName); if (binding == null || binding.getType() != BindingType.LOCAL_QUEUE) { throw HornetQMessageBundle.BUNDLE.noSuchQueue(queueName); } securityStore.check(binding.getAddress(), CheckType.CONSUME, this); Filter filter = FilterImpl.createFilter(filterString); ServerConsumer consumer = new ServerConsumerImpl( consumerID, this, (QueueBinding) binding, filter, started, browseOnly, storageManager, callback, preAcknowledge, strictUpdateDeliveryCount, managementService, supportLargeMessage, credits); consumers.put(consumer.getID(), consumer); if (!browseOnly) { TypedProperties props = new TypedProperties(); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress()); props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName()); props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName()); props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance()); Queue theQueue = (Queue) binding.getBindable(); props.putIntProperty(ManagementHelper.HDR_CONSUMER_COUNT, theQueue.getConsumerCount()); // HORNETQ-946 props.putSimpleStringProperty( ManagementHelper.HDR_USER, SimpleString.toSimpleString(username)); props.putSimpleStringProperty( ManagementHelper.HDR_REMOTE_ADDRESS, SimpleString.toSimpleString(this.remotingConnection.getRemoteAddress())); props.putSimpleStringProperty( ManagementHelper.HDR_SESSION_NAME, SimpleString.toSimpleString(name)); if (filterString != null) { props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filterString); } Notification notification = new Notification(null, CONSUMER_CREATED, props); if (HornetQServerLogger.LOGGER.isDebugEnabled()) { HornetQServerLogger.LOGGER.debug( "Session with user="******", connection=" + this.remotingConnection + " created a consumer on queue " + queueName + ", filter = " + filterString); } managementService.sendNotification(notification); } }