|
| 1 | +/** |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * <p> |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * <p> |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +package org.apache.activemq.artemis.core.server.impl; |
| 19 | + |
| 20 | +import java.util.concurrent.ScheduledExecutorService; |
| 21 | + |
| 22 | +import org.apache.activemq.artemis.api.core.Message; |
| 23 | +import org.apache.activemq.artemis.api.core.QueueConfiguration; |
| 24 | +import org.apache.activemq.artemis.api.core.SimpleString; |
| 25 | +import org.apache.activemq.artemis.core.filter.Filter; |
| 26 | +import org.apache.activemq.artemis.core.paging.PagingStore; |
| 27 | +import org.apache.activemq.artemis.core.paging.cursor.PageSubscription; |
| 28 | +import org.apache.activemq.artemis.core.persistence.StorageManager; |
| 29 | +import org.apache.activemq.artemis.core.postoffice.PostOffice; |
| 30 | +import org.apache.activemq.artemis.core.server.ActiveMQServer; |
| 31 | +import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; |
| 32 | +import org.apache.activemq.artemis.core.server.MessageReference; |
| 33 | +import org.apache.activemq.artemis.core.server.QueueFactory; |
| 34 | +import org.apache.activemq.artemis.core.settings.HierarchicalRepository; |
| 35 | +import org.apache.activemq.artemis.core.settings.impl.AddressSettings; |
| 36 | +import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; |
| 37 | + |
| 38 | +public class StoreAndForwardQueue extends QueueImpl { |
| 39 | + |
| 40 | + public StoreAndForwardQueue(QueueConfiguration queueConfiguration, |
| 41 | + Filter filter, |
| 42 | + PagingStore pagingStore, |
| 43 | + PageSubscription pageSubscription, |
| 44 | + ScheduledExecutorService scheduledExecutor, |
| 45 | + PostOffice postOffice, |
| 46 | + StorageManager storageManager, |
| 47 | + HierarchicalRepository<AddressSettings> addressSettingsRepository, |
| 48 | + ArtemisExecutor executor, |
| 49 | + ActiveMQServer server, |
| 50 | + QueueFactory factory) { |
| 51 | + super(queueConfiguration, filter, pagingStore, pageSubscription, scheduledExecutor, postOffice, storageManager, addressSettingsRepository, executor, server, factory); |
| 52 | + } |
| 53 | + |
| 54 | + @Override |
| 55 | + public boolean checkInvalid(final MessageReference ref) { |
| 56 | + Message message = ref.getMessage(); |
| 57 | + SimpleString idsHeaderName = Message.HDR_ROUTE_TO_IDS.concat(this.getName()); |
| 58 | + byte[] queueIds = message.getExtraBytesProperty(idsHeaderName); |
| 59 | + if (queueIds == null) { |
| 60 | + ActiveMQServerLogger.LOGGER.noQueueIdDefined(message, idsHeaderName); |
| 61 | + return true; |
| 62 | + } |
| 63 | + return false; |
| 64 | + } |
| 65 | +} |
0 commit comments