activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From belaie <maqsood.bha...@gmail.com>
Subject Norwegian character ActiveMQ consumer problem
Date Tue, 05 Nov 2013 22:50:23 GMT
Hello

I'm reading a que from ActiveMQ using ActiveMQ java client.  I'm have
problem reading norwegian characters such as Å,Æ, Ø from message body in the
que,    anyone can help?

Here is my code in java:



ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(this.getHostNameConnectionString());

            // Create a Connection
            Connection connection = connectionFactory.createConnection();
            connection.start();

            // Create a Session
            Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);

            // Create the destination (Topic or Queue)
            Destination destination =
session.createQueue(this.getQueName());

            // Create a MessageConsumer from the Session to the Topic or
Queue
            MessageConsumer consumer = session.createConsumer(destination);


            // Wait for a message 1 second, timeunut is in miliseconds
            Message message = consumer.receive(1000);

            if (message instanceof TextMessage) {

                File filetoWrite = new File(fileName);

                if(filetoWrite.exists()){
                   filetoWrite.delete();
                }

                TextMessage textMessage = (TextMessage) message;
                
				
		FileWriter fw = new FileWriter(filetoWrite.getAbsoluteFile(),true);
                BufferedWriter bw = new BufferedWriter(fw);
                bw.write(textMessage.getText());
                bw.close();

                messagePayLoad = "done#";

            } else {
                messagePayLoad  = "empty";
            }



--
View this message in context: http://activemq.2283324.n4.nabble.com/Norwegian-character-ActiveMQ-consumer-problem-tp4673926.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Mime
View raw message