org.apache.commons.messenger.task
Class ConsumerTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.commons.messenger.task.ConsumerTask

public class ConsumerTask
extends org.apache.tools.ant.Task

ConsumerTask is an Ant task which will publish all of the given text files as a JMS Text Message using a given JMS Connection (Messenger) and a Destination

Version:
$Revision: 155459 $
Author:
James Strachan

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
ConsumerTask()
           
 
Method Summary
 void execute()
          Performs the copy operation.
 int getCount()
           
 javax.jms.Destination getDestination()
          Getter for property destination.
 Messenger getMessenger()
           
 MessengerManager getMessengerManager()
          Getter for property messengerManager.
 String getMessengerName()
          Getter for property messengerName.
 String getSubject()
          Getter for property subject.
protected  void processMessage(javax.jms.Message message)
          Processes a given message
protected  void processMessageText(String text)
          Writes the given text to a file
 void setConfiguration(String uri)
          Sets the URI of the Messenger.xml configuration document to use to configure the messengers to use for this task.
 void setCount(int count)
          Setter for the number of messages to receive.
 void setDestination(javax.jms.Destination destination)
          Setter for property destination.
 void setDir(File dir)
          Sets the output directory
 void setMessenger(Messenger messenger)
          Sets the Messenger to be used
 void setMessengerManager(MessengerManager messengerManager)
          Setter for property messengerManager.
 void setMessengerName(String messengerName)
          Setter for property messengerName.
 void setSubject(String subject)
          Setter for property subject.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsumerTask

public ConsumerTask()
Method Detail

setDir

public void setDir(File dir)
Sets the output directory


getMessenger

public Messenger getMessenger()
                       throws javax.jms.JMSException
Throws:
javax.jms.JMSException

setMessenger

public void setMessenger(Messenger messenger)
Sets the Messenger to be used


getMessengerName

public String getMessengerName()
Getter for property messengerName.

Returns:
Value of property messengerName.

setMessengerName

public void setMessengerName(String messengerName)
Setter for property messengerName.

Parameters:
messengerName - New value of property messengerName.

getDestination

public javax.jms.Destination getDestination()
                                     throws javax.jms.JMSException
Getter for property destination.

Returns:
Value of property destination.
Throws:
javax.jms.JMSException

setDestination

public void setDestination(javax.jms.Destination destination)
Setter for property destination.

Parameters:
destination - New value of property destination.

getSubject

public String getSubject()
Getter for property subject.

Returns:
Value of property subject.

setSubject

public void setSubject(String subject)
Setter for property subject.

Parameters:
subject - New value of property subject.

getMessengerManager

public MessengerManager getMessengerManager()
Getter for property messengerManager.

Returns:
Value of property messengerManager.

setMessengerManager

public void setMessengerManager(MessengerManager messengerManager)
Setter for property messengerManager.

Parameters:
messengerManager - New value of property messengerManager.

setConfiguration

public void setConfiguration(String uri)
                      throws javax.jms.JMSException
Sets the URI of the Messenger.xml configuration document to use to configure the messengers to use for this task.

Throws:
javax.jms.JMSException

getCount

public int getCount()
Returns:
the number of messages to receive. A number less than or equal to 0 will receive messages forever

setCount

public void setCount(int count)
Setter for the number of messages to receive. A number less than or equal to 0 will receive messages forever


execute

public void execute()
             throws org.apache.tools.ant.BuildException
Performs the copy operation.

Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException

processMessage

protected void processMessage(javax.jms.Message message)
                       throws IOException,
                              javax.jms.JMSException
Processes a given message

Throws:
IOException
javax.jms.JMSException

processMessageText

protected void processMessageText(String text)
                           throws IOException
Writes the given text to a file

Throws:
IOException


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.