activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Posta <christian.po...@gmail.com>
Subject Re: Problem in VM broker url along with simpleAuthenticationPlugin in activemq
Date Thu, 27 Jun 2013 15:18:43 GMT
how are you loading up the broker? In the same JVM, right?


On Thu, Jun 27, 2013 at 2:03 AM, loganathan <logu.it86@gmail.com> wrote:

> 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) {
>                                 }
>                         }
>                 }
>         }
> }
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Problem-in-VM-broker-url-along-with-simpleAuthenticationPlugin-in-activemq-tp4668639.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message