Below is sample test code for connecting to tcp broker url and the
tcp://localhost:61616 url and simpleAuthenticationPlugin also configured in
context-activemq.xml below code is working fine if I given wrong username
and password its showing exception as "wrong username" but what's my problem
instead of tcp broker url and have acheives through vm broker url.
suppose if i configured vm://BrokerDefault url and
simpleAuthenticationPlugin in context-activemq.xml on that scanerio even if
i given wrong username and password the below code is not showing any
exception as "wrong username" how i can acheived it through vm broker url.Is
anyone help for this issue would be highly appreciated?
public class ExampleCheck {
private static final org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory
.getLog(ExampleCheck.class);
public static void main(String[] args) {
ConnectionFactory connectionFactory = null;
Connection connection = null;
Session session = null;
Queue queue = null;
MessageProducer producer = null;
final int NUM_MSGS = 20;
final String url = "tcp://localhost:61616";
try {
connectionFactory = new ActiveMQConnectionFactory(url);
log.info("Got ConnectionFactory");
connection = connectionFactory.createConnection("logu", "gafoor");
log.info("Got Connection");
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
log.info("Got Session");
queue =
session.createQueue("jms:queue:Testsubscription1.outbound.queue");
log.info("Got Destination");
producer = session.createProducer(queue);
log.info("Got Producer");
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
TextMessage message = session.createTextMessage();
for (int i = 0; i < NUM_MSGS; i++) {
message.setText("This is message " + (i + 1));
log.info("Sending message: " + message.getText());
Thread.sleep(5000);
producer.send(message);
producer.send(session.createMessage());
} catch (Exception e1) {
e1.printStackTrace();
} finally {
if (connection != null) {
try {
connection.close();
} catch (JMSException e) {
tcp://localhost:61616 url and simpleAuthenticationPlugin also configured in
context-activemq.xml below code is working fine if I given wrong username
and password its showing exception as "wrong username" but what's my problem
instead of tcp broker url and have acheives through vm broker url.
suppose if i configured vm://BrokerDefault url and
simpleAuthenticationPlugin in context-activemq.xml on that scanerio even if
i given wrong username and password the below code is not showing any
exception as "wrong username" how i can acheived it through vm broker url.Is
anyone help for this issue would be highly appreciated?
public class ExampleCheck {
private static final org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory
.getLog(ExampleCheck.class);
public static void main(String[] args) {
ConnectionFactory connectionFactory = null;
Connection connection = null;
Session session = null;
Queue queue = null;
MessageProducer producer = null;
final int NUM_MSGS = 20;
final String url = "tcp://localhost:61616";
try {
connectionFactory = new ActiveMQConnectionFactory(url);
log.info("Got ConnectionFactory");
connection = connectionFactory.createConnection("logu", "gafoor");
log.info("Got Connection");
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
log.info("Got Session");
queue =
session.createQueue("jms:queue:Testsubscription1.outbound.queue");
log.info("Got Destination");
producer = session.createProducer(queue);
log.info("Got Producer");
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
TextMessage message = session.createTextMessage();
for (int i = 0; i < NUM_MSGS; i++) {
message.setText("This is message " + (i + 1));
log.info("Sending message: " + message.getText());
Thread.sleep(5000);
producer.send(message);
producer.send(session.createMessage());
} catch (Exception e1) {
e1.printStackTrace();
} finally {
if (connection != null) {
try {
connection.close();
} catch (JMSException e) {