com.caucho.jms.file
Class FileQueue

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractQueue
          extended by com.caucho.jms.queue.AbstractDestination
              extended by com.caucho.jms.queue.AbstractQueue
                  extended by com.caucho.jms.file.FileQueue
All Implemented Interfaces:
HandleAware, java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.concurrent.BlockingQueue, java.util.Queue, Destination, Topic

public class FileQueue
extends AbstractQueue
implements Topic

A JMS queue backed by a file-based database. The URL looks like

 file:name=my-name;path=file:/var/www/webapps/test/WEB-INFjms
 
It is configured as:
 <jms-queue jndi-name="jms/my-name" uri="file:path=WEB-INF/jms"/>
 

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.caucho.jms.queue.AbstractDestination
_messageFactory
 
Constructor Summary
FileQueue()
           
FileQueue(java.lang.String name)
           
 
Method Summary
 void acknowledge(java.lang.String msgId)
          Rollsback the message from the store.
 Path getPath()
           
 int getQueueSize()
          Returns the queue size
 java.lang.String getUrl()
          Returns the JMS configuration url.
 void init()
          Initialize the queue
 MessageImpl receive(boolean isAutoAck)
          Polls the next message from the store.
 void removeMessage(java.lang.String msgId)
          Rollsback the message from the store.
 void rollback(java.lang.String msgId)
          Rollsback the message from the store.
 void send(JmsSession session, MessageImpl msg, int priority, long expires)
          Adds the message to the persistent store.
 void sendBackup(JmsSession session, MessageImpl msg, long leaseTimeout, int priority, long expires)
          Adds the message to the persistent store.
 void setPath(Path path)
          Sets the path to the backing database
 void setTablePrefix(java.lang.String prefix)
           
 
Methods inherited from class com.caucho.jms.queue.AbstractQueue
addListenerException, addMessageAvailableListener, close, getBrowserList, getConsumerCount, getListenerFailCountTotal, getListenerFailLastTime, notifyMessageAvailable, postConstruct, removeMessageAvailableListener, setQueueName, startPoll, stopPoll
 
Methods inherited from class com.caucho.jms.queue.AbstractDestination
drainTo, drainTo, generateMessageID, generateMessageID, getJMSDestination, getName, getQueueName, getReadConsumer, getTopicName, getWriteSession, hasMessage, iterator, offer, offer, peek, poll, poll, put, remainingCapacity, setName, setSerializationHandle, size, take, toString
 
Methods inherited from class java.util.AbstractQueue
add, addAll, clear, element, remove
 
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jms.Topic
getTopicName, toString
 
Methods inherited from interface javax.jms.Queue
getQueueName, toString
 
Methods inherited from interface java.util.concurrent.BlockingQueue
add, contains, remove
 
Methods inherited from interface java.util.Queue
element, remove
 
Methods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Constructor Detail

FileQueue

public FileQueue()

FileQueue

public FileQueue(java.lang.String name)
Method Detail

setPath

public void setPath(Path path)
Sets the path to the backing database


getPath

public Path getPath()

setTablePrefix

public void setTablePrefix(java.lang.String prefix)

getUrl

public java.lang.String getUrl()
Returns the JMS configuration url.

Overrides:
getUrl in class AbstractDestination

getQueueSize

public int getQueueSize()
Description copied from class: AbstractQueue
Returns the queue size

Overrides:
getQueueSize in class AbstractQueue

init

public void init()
Initialize the queue

Overrides:
init in class AbstractQueue

send

public void send(JmsSession session,
                 MessageImpl msg,
                 int priority,
                 long expires)
Adds the message to the persistent store. Called if there are no active listeners.

Specified by:
send in class AbstractDestination
Parameters:
msg - the message to store
expires - the expires time

sendBackup

public void sendBackup(JmsSession session,
                       MessageImpl msg,
                       long leaseTimeout,
                       int priority,
                       long expires)
Adds the message to the persistent store. Called if there are no active listeners.

Parameters:
msg - the message to store
expires - the expires time

receive

public MessageImpl receive(boolean isAutoAck)
Polls the next message from the store. If no message is available, wait for the timeout.

Overrides:
receive in class AbstractDestination
Parameters:
isAutoAck - if true, automatically acknowledge the message

rollback

public void rollback(java.lang.String msgId)
Rollsback the message from the store.

Overrides:
rollback in class AbstractDestination

acknowledge

public void acknowledge(java.lang.String msgId)
Rollsback the message from the store.

Overrides:
acknowledge in class AbstractDestination
Parameters:
msgId - message to acknowledge

removeMessage

public void removeMessage(java.lang.String msgId)
Rollsback the message from the store.