alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

ActiveMQ example source code file (ProxyMessageStore.java)

This example ActiveMQ source code file (ProxyMessageStore.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - ActiveMQ tags/keywords

activemqdestination, exception, exception, future, io, ioexception, ioexception, message, message, messageack, messagerecoverylistener, messagestore, messagestore, proxymessagestore, threading, threads

The ActiveMQ ProxyMessageStore.java source code

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.activemq.store;

import java.io.IOException;
import java.util.concurrent.Future;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.Message;
import org.apache.activemq.command.MessageAck;
import org.apache.activemq.command.MessageId;
import org.apache.activemq.usage.MemoryUsage;

/**
 * A simple proxy that delegates to another MessageStore.
 */
public class ProxyMessageStore implements MessageStore {

    final MessageStore delegate;

    public ProxyMessageStore(MessageStore delegate) {
        this.delegate = delegate;
    }

    public MessageStore getDelegate() {
        return delegate;
    }

    public void addMessage(ConnectionContext context, Message message) throws IOException {
        delegate.addMessage(context, message);
    }

    public Message getMessage(MessageId identity) throws IOException {
        return delegate.getMessage(identity);
    }

    public void recover(MessageRecoveryListener listener) throws Exception {
        delegate.recover(listener);
    }

    public void removeAllMessages(ConnectionContext context) throws IOException {
        delegate.removeAllMessages(context);
    }

    public void removeMessage(ConnectionContext context, MessageAck ack) throws IOException {
        delegate.removeMessage(context, ack);
    }

    public void start() throws Exception {
        delegate.start();
    }

    public void stop() throws Exception {
        delegate.stop();
    }

    public void dispose(ConnectionContext context) {
        delegate.dispose(context);
    }

    public ActiveMQDestination getDestination() {
        return delegate.getDestination();
    }

    public void setMemoryUsage(MemoryUsage memoryUsage) {
        delegate.setMemoryUsage(memoryUsage);
    }

    public int getMessageCount() throws IOException {
        return delegate.getMessageCount();
    }

    public void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception {
        delegate.recoverNextMessages(maxReturned, listener);

    }

    public void resetBatching() {
        delegate.resetBatching();

    }

    public void setBatch(MessageId messageId) throws Exception {
        delegate.setBatch(messageId);
    }

    public boolean isEmpty() throws Exception {
       return delegate.isEmpty();
    }

    public Future<Object> asyncAddQueueMessage(ConnectionContext context, Message message) throws IOException {
       return delegate.asyncAddQueueMessage(context, message);
    }
    
    public Future<Object> asyncAddTopicMessage(ConnectionContext context, Message message) throws IOException {
        return delegate.asyncAddTopicMessage(context, message);
     }
    
    public void removeAsyncMessage(ConnectionContext context, MessageAck ack) throws IOException {
        delegate.removeAsyncMessage(context, ack);       
    }

    public void setPrioritizedMessages(boolean prioritizedMessages) {
        delegate.setPrioritizedMessages(prioritizedMessages);
    }

    public boolean isPrioritizedMessages() {
        return delegate.isPrioritizedMessages();
    }
}

Other ActiveMQ examples (source code examples)

Here is a short list of links related to this ActiveMQ ProxyMessageStore.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.