git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@663048 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-06-04 10:20:47 +00:00
parent 2ccbdefc69
commit 5cd2921c4e
2 changed files with 32 additions and 4 deletions

View File

@ -239,8 +239,16 @@ public class DestinationView implements DestinationViewMBean {
public String sendTextMessage(String body) throws Exception {
return sendTextMessage(Collections.EMPTY_MAP, body);
}
public String sendTextMessage(Map headers, String body) throws Exception {
return sendTextMessage(headers,body,null,null);
}
public String sendTextMessage(String body, String user, String password) throws Exception {
return sendTextMessage(Collections.EMPTY_MAP,body,null,null);
}
public String sendTextMessage(Map headers, String body,String userName,String password) throws Exception {
String brokerUrl = "vm://" + broker.getBrokerName();
ActiveMQDestination dest = destination.getActiveMQDestination();
@ -249,7 +257,7 @@ public class DestinationView implements DestinationViewMBean {
Connection connection = null;
try {
connection = cf.createConnection();
connection = cf.createConnection(userName,password);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(dest);
ActiveMQTextMessage msg = (ActiveMQTextMessage)session.createTextMessage(body);
@ -333,6 +341,5 @@ public class DestinationView implements DestinationViewMBean {
public void setUseCache(boolean value) {
destination.setUseCache(value);
}
}
}

View File

@ -133,6 +133,27 @@ public interface DestinationViewMBean {
*/
String sendTextMessage(Map headers, String body) throws Exception;
/**
* Sends a TextMesage to the destination.
* @param body the text to send
* @param user
* @param password
* @return
* @throws Exception
*/
String sendTextMessage(String body, String user, String password) throws Exception;
/**
*
* @param headers the message headers and properties to set. Can only
* container Strings maped to primitive types.
* @param body the text to send
* @param user
* @param password
* @return
* @throws Exception
*/
String sendTextMessage(Map headers, String body, String user, String password) throws Exception;
/**
* @return the percentage of amount of memory used
*/