activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JavyRocks <javy.ro...@gmail.com>
Subject Re: No IConnectionFactory implementation found for connection URI: activemq:tcp://localhost:61616
Date Thu, 11 Apr 2013 15:39:40 GMT
Active MQ
Hi Every One

I Hope this would help someone

In order to connect to an ActiveMQ Broker from .NET aplication using VB
language for really newbies 

Follow this Steps

1. Download Java JDK from this link 
http://www.oracle.com/technetwork/es/java/javase/downloads/index.html

2. Install and configure the JAVA_HOME variable

3. Download the ActiveMQ Server  5.8
http://activemq.apache.org/activemq-580-release.html
4. Follow the installation guide

5 Download the NMS DLLs 1.4.0
http://activemq.apache.org/nms/apachenms-api-v140.html


6. Start the server

7. Create a new project in Visual Studio targetting the 3.5 FrameWork

8. Add these References to the project
                 ActiveMQ 1.4\build\net-3.5\debug
                             Apache.NMS.ActiveMQ.dll
                 ActiveMQ 1.4\lib\Apache.NMS\net-3.5
                             Apache.NMS.dll

Use this code

Imports Apache.NMS
Imports Apache.NMS.ActiveMQ
Imports Apache.NMS.Util

Module Module1

    Sub Main()
        Call Verificar_Reportes_ActiveMQ()
    End Sub

    Public Function Verificar_Reportes_ActiveMQ() As Boolean
Try


            Dim conConexion As Uri
            Dim cofConnector As IConnectionFactory
            conConexion = New Uri("activemq:tcp://localhost:61616")
            'conConexion = New Uri(Me.objGeneral.DireccionMQ & ":" &
Me.objGeneral.PuertoMQ)
            cofConnector = New NMSConnectionFactory(conConexion)

            console.Text = "About to connect to " + conConexion.ToString

            'Using objConexion As IConnection =
cofConnector.CreateConnection("admin", "admin")
            Using objConexion As IConnection =
cofConnector.CreateConnection()
                Using objSesion As ISession = objConexion.CreateSession()

                    Dim objDestino As IDestination =
SessionUtil.GetDestination(objSesion, "queue://FOO.BAR")

                    Using objConsumidor As IMessageConsumer =
objSesion.CreateConsumer(objDestino)
                        Using objProductor As IMessageProducer =
objSesion.CreateProducer(objDestino)
                            objConexion.Start()

                            Dim objSolicitud As ITextMessage =
objSesion.CreateTextMessage("Javy Rocks")
                            objSolicitud.NMSCorrelationID = "abc"
                            objSolicitud.Properties("NMSXGroupID") =
"Javier"
                            objSolicitud.Properties("myHeader") =
"CastaƱeda"

                            objProductor.Send(objSolicitud)

                            Dim objMensajeRespuesta As ITextMessage =
objConsumidor.Receive

                            If Not IsNothing(objMensajeRespuesta) Then
                                MsgBox("Mensaje Recibido = " &
objMensajeRespuesta.Text)
                            End If

                        End Using
                    End Using
                End Using
            End Using

            Return True
        Catch ex As Exception
            MsgBox("Error" & ex.Message)
            Return False
        End Try




--
View this message in context: http://activemq.2283324.n4.nabble.com/No-IConnectionFactory-implementation-found-for-connection-URI-activemq-tcp-localhost-61616-tp4665743p4665862.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message