activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximus <sujith.me...@oatsystems.com>
Subject Re: Connection Error to Apache
Date Tue, 25 Sep 2012 05:36:52 GMT
Tim,

Did you mean    <transportConnector name="Stomp" uri="tcp://0.0.0.0:61613
"/> ?

I will tell what i have been doing so far. Please help me with this setup
as i'm new to messaging

1. Downloaded ActiveMQ 5.6.0. Ran the ProducerTool and ConsumerTool
examples provided in the download with "openwire" as the transport
protocol. Works fine.
2. Created another transportConnector for stomp as shown above. Changed
build.xml file to connect with the new protocol. Works fine.
3. The above two were tested in java. My client is C# .NET CF. So i created
a consumer and producer sample in C# . I added Apache.NMS and Apache.Stomp
dlls for .NET 3.5 ( just wanted to test as desktop app) .
     Running the same gives me the following error :

ex = {"Unable to read data from the transport connection: An established
connection was aborted by the software in your host machine."} in
TcpTransport.

Attaching the producer sample below

using System;
using System.Collections.Generic;
using System.Text;
using Apache.NMS;
using Apache.NMS.Util;
using Apache.NMS.Stomp;

namespace ActiveMQSample
{
    class Program
    {
        static void Main(string[] args)
        {
            TestMain test = new TestMain();
            test.CallMe(null);
        }
    }
    public class TestMain
    {
        public void CallMe(string[] args)
        {
            // Example connection strings:
            //    activemq:tcp://activemqhost:61616
            //    stomp:tcp://activemqhost:61613
            //    ems:tcp://tibcohost:7222
            //    msmq://localhost

            Uri connecturi = new Uri("tcp://172.26.37.64:61613");
            //connecturi.Scheme = " ";

            Console.WriteLine("About to connect to " + connecturi);

            // NOTE: ensure the nmsprovider-activemq.config file exists in
the executable folder.
            //string broker =
Apache.NMS.Stomp.ConnectionFactory.GetDefaultBrokerUrl();
            IConnectionFactory factory = new ConnectionFactory(connecturi);

            IConnection connection = factory.CreateConnection();
            ISession session = connection.CreateSession();
            // Examples for getting a destination:
            //
            // Hard coded destinations:
            //    IDestination destination = session.GetQueue("FOO.BAR");
            //    Debug.Assert(destination is IQueue);
            //    IDestination destination = session.GetTopic("FOO.BAR");
            //    Debug.Assert(destination is ITopic);
            //
            // Embedded destination type in the name:
            //    IDestination destination = SessionUtil.GetDestination
(session, "queue://FOO.BAR");
            //    Debug.Assert(destination is IQueue);
            //    IDestination destination = SessionUtil.GetDestination
(session, "topic://FOO.BAR");
            //    Debug.Assert(destination is ITopic);
            //
            // Defaults to queue if type is not specified:
            //    IDestination destination = SessionUtil.GetDestination
(session, "FOO.BAR");
            //    Debug.Assert(destination is IQueue);
            //
            // .NET 3.5 Supports Extension methods for a simplified syntax:
            //    IDestination destination = session.GetDestination
("queue://FOO.BAR");
            //    Debug.Assert(destination is IQueue);
            //    IDestination destination = session.GetDestination
("topic://FOO.BAR");
            //    Debug.Assert(destination is ITopic);

            IDestination destination = SessionUtil.GetDestination(session,
"queue://FOO.BAR");
            Console.WriteLine("Using destination: " + destination);
            // Create a consumer and producer
            //IMessageConsumer consumer = session.CreateConsumer
(destination);
             IMessageProducer producer = session.CreateProducer
(destination);
            // Start the connection so that messages will be processed.
            connection.Start();
            //producer.Persistent = true;

            // Send a message
            ITextMessage request = session.CreateTextMessage("Hello
World!");
            request.NMSCorrelationID = "abc";
            request.Properties["NMSXGroupID"] = "cheese";
            request.Properties["myHeader"] = "Cheddar";

            producer.Send(request);

            // Consume a message
            //ITextMessage message = consumer.Receive() as ITextMessage;
            //if (message == null)
            {
                Console.WriteLine("No message received!");
            }
            //else
            {
               // Console.WriteLine("Received message with ID:   " +
message.NMSMessageId);
               // Console.WriteLine("Received message with text: " +
message.Text);
            }
        }
    }
}

Regards,
Sujith




From:	"tabish121@gmail.com [via ActiveMQ]" <ml-node
            +s2283324n4656848h73@n4.nabble.com>
To:	maximus <sujith.menon@oatsystems.com>
Date:	09/24/2012 07:14 PM
Subject:	Re: Connection Error to Apache



On Fri, 2012-09-21 at 02:59 -0700, sujithmenono wrote:

> Hi,
>
> I'm trying to write sample code for client/server communication using
> Apache.NMS.Stomp.
>
> Uri connecturi = new Uri("tcp://0.0.0.0:61616");
>
> Console.WriteLine("About to connect to " + connecturi);
>
> // NOTE: ensure the nmsprovider-activemq.config file exists in the
> executable folder.
> *IConnectionFactory factory =
> NMSConnectionFactory.CreateConnectionFactory(connecturi,null);
> *
> I get the following error while creating the connection factory.
> *
> "No IConnectionFactory implementation found for connection URI:
> tcp://0.0.0.0:61616/"*
>
> This is my setting in activemq.xml
> <transportConnectors>
>             <transportConnector name="default"
uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
>

You have configured an openwire transport connector on port 61616.  You
need to configure a STOMP transport connector.

<transportConnector name="Stomp" uri="stomp://0.0.0.0:61613"/>

>
>
> --
> View this message in context:
http://activemq.2283324.n4.nabble.com/Connection-Error-to-Apache-tp4656810.html

> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

--
Tim Bish
Sr Software Engineer | FuseSource Corp
[hidden email] | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/




If you reply to this email, your message will be added to the discussion
below:
http://activemq.2283324.n4.nabble.com/Connection-Error-to-Apache-tp4656810p4656848.html

To unsubscribe from Connection Error to Apache, click here.
NAML






--
View this message in context: http://activemq.2283324.n4.nabble.com/Connection-Error-to-Apache-tp4656810p4656886.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message