ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » CodedCharSetId Problem

Post new topic  Reply to topic
 CodedCharSetId Problem « View previous topic :: View next topic » 
Author Message
paldebojyoti
PostPosted: Tue Oct 26, 2004 10:13 pm    Post subject: CodedCharSetId Problem Reply with quote

Novice

Joined: 04 Aug 2004
Posts: 10

Hi,
I am facing a problem. Our java application publishes a message whose CodedCharSetId is 819 but the message is being retrieved using JMS queue classes and they see messages as byte message which is basically unreadable. But they are able to parse the messages published whose CodedCharSetId has a value 1051.
Regards,
Debojyoti
Back to top
View user's profile Send private message
kirani
PostPosted: Tue Oct 26, 2004 10:16 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Are thse two messages coming from different sources?
Can you share the piece of code where you are reasding the message from queue?
Are these text messages?
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
cramnath
PostPosted: Mon Nov 01, 2004 10:07 am    Post subject: Update..... Reply with quote

Newbie

Joined: 01 Nov 2004
Posts: 1
Location: Elk Grove Village, IL, USA

I work with user who intiated this thread.

Here is more info.....

Messages are published with CCSID 819 through Publish Node in WMQI 2.1

All user apps can get messages properly, but there is this one JMS application that gets the message and somehow turns it to CCSID 1051. So when they get body of message it is "bytes" not "text".

They used to get messages with CCSID of 1051 before, so their code worked before. Now they get with CCSID 819 and it does not.

Here is code of client app.....


------------------------Start of Code-------------------------------------------------
package jfilter;

import java.util.*;
import javax.jms.*;
import javax.naming.*;
import com.ibm.mq.jms.*;

public class QueueListener
{
private Map queueParameters = null;
private QueueConnection connection = null;
private MessageListener messageListener = null;
private ExceptionListener exceptionListener = null;
private int reconnectDelaySeconds = 30; //default to 30 seconds before trying reconnect
private String queueName = null;
private Logger logger = null;

public QueueListener(Map params, MessageListener messageListener, ExceptionListener exceptionListener)
throws JMSException
{
this.messageListener = messageListener;
this.exceptionListener = exceptionListener;
if (exceptionListener == null)
this.exceptionListener = new SimpleExceptionListener();
queueParameters = params;

//register a simple logger that writes to stdout
registerLogger(new Logger() {
public void log(String msg) {
System.out.println((new Date()).toString() + "> " + msg);
}
});
}

public QueueListener(Map params, MessageListener messageListener)
throws JMSException
{
this(params, messageListener, null);
}

public QueueListener(Map params)
throws JMSException
{
this(params, new SimpleMessageListener(), null);
}

public interface Logger
{
void log(String msg);
}

public void registerLogger(Logger logger)
{
this.logger = logger;
}

public void start()
throws JMSException, NamingException
{
establishConnection();
if (connection != null)
connection.start();
}

public void close()
{
try {
if (connection != null)
{
connection.stop();
connection.close();
}
}
catch (JMSException e) {
/* nothing worthwhile we can do */
}
finally {
connection = null;
}
}

public void setReconnectDelay(int seconds)
{
reconnectDelaySeconds = seconds;
}

public int getReconnectDelay()
{
return reconnectDelaySeconds;
}

protected QueueConnectionFactory getFactory(Map map)
throws JMSException, IllegalArgumentException
{
QueueConnectionFactory retval = null;

String queueType = (String)map.get("QType");
if (queueType == null)
throw new IllegalArgumentException("Missing value: QType");
else if (queueType.equals("MQRemote"))
{
final int DEFAULT_PORT = 2072;
MQQueueConnectionFactory mqFactory = new MQQueueConnectionFactory();
mqFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);

String s = null;

if ((s = (String)map.get("QName")) == null)
throw new IllegalArgumentException("Missing value: QName");
queueName = s;

if ((s = (String)map.get("QManager")) == null)
throw new IllegalArgumentException("Missing value: QManager");
mqFactory.setQueueManager(s);

if ((s = (String)map.get("QChannel")) == null)
throw new IllegalArgumentException("Missing value: QChannel");
mqFactory.setChannel(s);

if ((s = (String)map.get("QHost")) == null)
throw new IllegalArgumentException("Missing value: QHost");
mqFactory.setHostName(s);

int i;
try {
i = Integer.parseInt((String)map.get("QPort"));
}
catch (Exception e) {
i = DEFAULT_PORT;
}
mqFactory.setPort(i);

retval = mqFactory;
}
else if (queueType.equals("WebLogic"))
{
// WORK
}
else
throw new IllegalArgumentException("Queue type unknown: " + queueType);

return retval;
}

private void establishConnection()
throws JMSException, NamingException
{
log("establishConnection()");
QueueConnectionFactory factory = getFactory(queueParameters);
connection = factory.createQueueConnection();
connection.setExceptionListener(exceptionListener);
QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue(queueName);
QueueReceiver queueReceiver = session.createReceiver(queue);
queueReceiver.setMessageListener(messageListener);
}

private void log(String msg)
{
if (logger != null)
logger.log(msg);
}

private class SimpleExceptionListener implements ExceptionListener
{
public void onException(JMSException jmse)
{
boolean connected = false;

close();
while (!connected)
{
try {
log("Reconnect listener [" + jmse.toString() + "]");
Thread.sleep(reconnectDelaySeconds * 1000);
start();
connected = true;
}
catch(Exception e) {
log("Exception during reconnect [" + e.toString() + "]");
}
}
}
}

private static class SimpleMessageListener implements MessageListener
{
public void onMessage(Message msg)
{
String type = "UNKNOWN";

if (msg instanceof TextMessage)
type = "TextMessage";
else if (msg instanceof MapMessage)
type = "MapMessage";
else if (msg instanceof BytesMessage)
type = "BytesMessage";
else if (msg instanceof ObjectMessage)
type = "ObjectMessage";
else if (msg instanceof StreamMessage)
type = "StreamMessage";

System.out.println("Retrieved " + type + " message [" + msg + "]\n");
}
}
}
----------------------------END of CODE-----------------------------------------
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 01, 2004 1:09 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Other possibility: You do have a TextMessage but it was sent from a non JMS app and the app did not set the format (default is RAW). The sending app would need to set the format to MQSTR, otherwise treat as BytesMessage.
Alternatively the system cannot translate from ccsid 1051 to 819...
Check your translation tables and set it up. Read up on manuals...

Enjoy
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » CodedCharSetId Problem
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.