2

Whenever i try to publish a message from esb to message broker's topic, i get this error

[2013-04-19 14:51:45,930] ERROR - AMQConnection Throwable Received but no listener set: org.wso2.andes.client.AMQNoRoute
Exception: Error: No Route for message [error code 312: no route]

My proxy code is

    <proxy name="SendMessageProxy" transports="http" startOnLoad="true">    
<target>       
<endpoint>          
<address uri="jms:/myTopic?&amp;transport.jms.DestinationType=topic"/>       
</endpoint>       
<inSequence>          
<log level="custom">             
<property name="STATE" value="message is sent to queue"/>         
 </log>          
<property name="OUT_ONLY" value="true"/>          
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>       
</inSequence>       
<outSequence/>    
</target> 
</proxy>`

My jndi configuration and axis 2 configuration are properly configured.My MB is running on port 9444 and Publisher_esb is running on 9443 and subscriber esb is running at port 9446. When i keep my subscriber active and then if i post a message from my publisher the message gets reflected to the subsciber.

Code to get message from subscriber is

package xml.parser;

import org.w3c.dom.*;
import javax.xml.xpath.*;
import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.*;

import java.io.IOException;
import java.util.Enumeration;
import java.util.Iterator;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.jms.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;

public class Parser {

    public static final String QPID_ICF = "org.wso2.andes.jndi.PropertiesFileInitialContextFactory";
    private static final String CF_NAME_PREFIX = "connectionfactory.";
    private static final String CF_NAME = "qpidConnectionfactory";
    String userName = "admin";
    String password = "admin";
    private static String CARBON_CLIENT_ID = "carbon";
    private static String CARBON_VIRTUAL_HOST_NAME = "carbon";
    private static String CARBON_DEFAULT_HOSTNAME = "localhost";
    private static String CARBON_BROKER_PORT = "5673";
    String topicName = "myTopic";

    public static void main(String[] args) throws NamingException,
            JMSException, XPathExpressionException,
            ParserConfigurationException, SAXException, IOException {

        Parser queueReceiver = new Parser();
        String message = queueReceiver.subscribe();

    }


    public String subscribe() throws NamingException, JMSException {

        String messageContent = "";
    Properties properties = new Properties();
    properties.put(Context.INITIAL_CONTEXT_FACTORY, QPID_ICF);
    properties.put(CF_NAME_PREFIX + CF_NAME,
            getTCPConnectionURL(userName, password));
    properties.put("topic." + topicName, topicName);
    System.out.println("getTCPConnectionURL(userName,password) = "
            + getTCPConnectionURL(userName, password));
    InitialContext ctx = new InitialContext(properties);
    // Lookup connection factory
    TopicConnectionFactory connFactory = (TopicConnectionFactory) ctx
            .lookup(CF_NAME);
    TopicConnection topicConnection = connFactory.createTopicConnection();
    topicConnection.start();
    TopicSession topicSession = topicConnection.createTopicSession(false,
            QueueSession.AUTO_ACKNOWLEDGE);
    // Send message
    //Topic topic = topicSession.createTopic(topicName);
    Topic topic = (Topic) ctx.lookup(topicName);
    javax.jms.TopicSubscriber topicSubscriber = topicSession
            .createDurableSubscriber(topic,"admin");
    Message message = topicSubscriber.receive();
    if (message instanceof TextMessage) {
        TextMessage textMessage = (TextMessage) message;
        System.out.println("textMessage.getText() = "
                + textMessage.getText());
        messageContent = textMessage.getText();
    }
    topicSession.close();
    topicConnection.close();

    return messageContent;      }

    public String getTCPConnectionURL(String username, String password) {
        return new StringBuffer().append("amqp://").append(username)
                .append(":").append(password).append("@")
                .append(CARBON_CLIENT_ID).append("/")
                .append(CARBON_VIRTUAL_HOST_NAME).append("?brokerlist='tcp://")
                .append(CARBON_DEFAULT_HOSTNAME).append(":")
                .append(CARBON_BROKER_PORT).append("'").toString();

    }

}

Whne i ran the subscriber for the first time it gave me the result but after that it is giving exception as:

[2013-04-19 17:24:26,947] ERROR {org.wso2.andes.transport.network.mina.MinaNetworkHandler} -  Exception caught by Mina
java.io.IOException: An existing connection was forcibly closed by the remote host
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:218)
        at sun.nio.ch.IOUtil.read(IOUtil.java:191)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:359)
        at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:218)
        at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198)
        at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45)
        at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485)
        at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
        at java.lang.Thread.run(Thread.java:722)
[2013-04-19 17:24:26,957] ERROR {org.wso2.andes.server.protocol.AMQProtocolEngine} -  IOException caught in/127.0.0.1:16
513(admin), session closed implictly: java.io.IOException: An existing connection was forcibly closed by the remote host

[2013-04-19 17:33:40,283]  INFO {org.wso2.andes.server.protocol.AMQProtocolEngine} -  Closing channel due to: Cannot sub
scribe to queue carbon:admin as it already has an existing exclusive consumer
[2013-04-19 17:33:40,283]  INFO {org.wso2.andes.server.protocol.AMQProtocolEngine} -  Channel[1] awaiting closure - proc
essing close-ok
[2013-04-19 17:33:40,283]  INFO {org.wso2.andes.server.handler.ChannelCloseOkHandler} -  Received channel-close-ok for c
hannel-id 1
[2013-04-19 17:40:48,867]  INFO {org.wso2.andes.server.queue.SimpleAMQQueue} -  Auto-deleteing queue:tmp_127_0_0_1_16587
_1

Can't i post messages to the topic without making my subscriber active. How can i make my message durable or persistent? And one more question i have is: How can i get the queueName associated with the topic that i created aor can i create a queue specifically for my topic myTopic? Looking forward to your answers. Thanks in advance

Community
  • 1
  • 1
Roy
  • 1,231
  • 1
  • 24
  • 61

1 Answers1

0

The durable subscribers in MB 2.0.1 have some known issues and this may to due to that. Please try with MB 2.1.0 - Alpha version from here and see whether it is resolved here. These issues will be fixed in MB 2.1.0 which is to be released in few weeks.

Ishara
  • 141
  • 5