You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Dejan Bosanac <de...@nighttale.net> on 2013/07/01 17:56:55 UTC

Re: Is simpleauthentication required for vm broker url in activemq?

Hi,

authentication plugin is used even if you're using vm transport. To connect
you need to pass username and password to you connection. This is needed as
your clients can be later authorized for access to different destinations.

Regards
--
Dejan Bosanac
----------------------
Red Hat, Inc.
FuseSource is now part of Red Hat
dbosanac@redhat.com
Twitter: @dejanb
Blog: http://sensatic.net
ActiveMQ in Action: http://www.manning.com/snyder/


On Sat, Jun 29, 2013 at 11:50 AM, loganathan <lo...@gmail.com> wrote:

> i have added the following code in context_activemq.xml for
> simpleauthentication for vm brokerurl.As i am new to activemq i don't know
> exactly is simpleauthentication is required for vm brokerurl?if its
> required
> means how i can acheived through simpleauthentication technique in
> activemq?Is anyone help for this problem would be highly appreciated.
>
> <bean id ="amqConnectionFactory"
>                 class="org.apache.activemq.ActiveMQConnectionFactory">
>                 <property name="brokerURL"
>                         value="vm://brokerexample" />
>                         <property name="userName" value="publisher" />
>                 <property name="password" value="password" />
>         </bean>
>
> <amq:broker start="true" persistent="true"
>                 brokerName="brokerexample"
>                 deleteAllMessagesOnStartup="false" >
>
> <amq:transportConnectors>
>                         <amq:transportConnector name="tcp"
>                                 uri="vm://brokerexample"/>
>                 </amq:transportConnectors>
>
> <amq:plugins>
>                          <amq:simpleAuthenticationPlugin>
>                                 <amq:users>
>                                         <amq:authenticationUser
> id="example" username="publisher"
> password="password" groups="users,admins" />
>                                         </amq:users>
>                                 </amq:simpleAuthenticationPlugin>
>     </amq:plugins>
>         </amq:broker>
> </beans>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Is-simpleauthentication-required-for-vm-broker-url-in-activemq-tp4668721.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Is simpleauthentication required for vm broker url in activemq?

Posted by Dejan Bosanac <de...@nighttale.net>.
Yeah, the best way is to create a simple test that demonstrates what you're
experiencing. It'll be easier to spot a problem with it.

Regards
--
Dejan Bosanac
----------------------
Red Hat, Inc.
FuseSource is now part of Red Hat
dbosanac@redhat.com
Twitter: @dejanb
Blog: http://sensatic.net
ActiveMQ in Action: http://www.manning.com/snyder/


On Thu, Jul 4, 2013 at 3:02 PM, loganathan <lo...@gmail.com> wrote:

> even if i am using brokerexample it not showing any exception as "invalid
> username" if i given invalid username and password to connect.Can you
> suggest me to move forward?
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Is-simpleauthentication-required-for-vm-broker-url-in-activemq-tp4668721p4668874.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Is simpleauthentication required for vm broker url in activemq?

Posted by loganathan <lo...@gmail.com>.
even if i am using brokerexample it not showing any exception as "invalid
username" if i given invalid username and password to connect.Can you
suggest me to move forward?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-simpleauthentication-required-for-vm-broker-url-in-activemq-tp4668721p4668874.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Is simpleauthentication required for vm broker url in activemq?

Posted by Dejan Bosanac <de...@nighttale.net>.
The problem is that you're using different broker name brokerDefault, which
will create a new embedded broker instead of using the one you created
earlier named brokerexample

Regards
--
Dejan Bosanac
----------------------
Red Hat, Inc.
FuseSource is now part of Red Hat
dbosanac@redhat.com
Twitter: @dejanb
Blog: http://sensatic.net
ActiveMQ in Action: http://www.manning.com/snyder/


On Tue, Jul 2, 2013 at 7:16 AM, loganathan <lo...@gmail.com> wrote:

> Thanks for your response dejan.Below is the code for checking whether the
> configured vm broker url in context_activemq.xml(see first post) is working
> or not.even if i am giving wrong username and password its connecting its
> not showing any exception as "invalid username" Is the below code is
> correct
> for checking vm broker url?can you help me for this?
>
> 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;
>
>
>                 try {
>                         connectionFactory = new
> ActiveMQConnectionFactory("vm://brokerDefault");
>                         log.info("Got ConnectionFactory");
>
>                         connection =
> connectionFactory.createConnection("aaaaaaaa", "pass");
>                         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/Is-simpleauthentication-required-for-vm-broker-url-in-activemq-tp4668721p4668773.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Is simpleauthentication required for vm broker url in activemq?

Posted by loganathan <lo...@gmail.com>.
Thanks for your response dejan.Below is the code for checking whether the
configured vm broker url in context_activemq.xml(see first post) is working
or not.even if i am giving wrong username and password its connecting its
not showing any exception as "invalid username" Is the below code is correct
for checking vm broker url?can you help me for this?

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;


		try {
			connectionFactory = new ActiveMQConnectionFactory("vm://brokerDefault");
			log.info("Got ConnectionFactory");

			connection = connectionFactory.createConnection("aaaaaaaa", "pass");
			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/Is-simpleauthentication-required-for-vm-broker-url-in-activemq-tp4668721p4668773.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.