从MQ中的传入消息中删除RFH2头

时间:2015-11-02 13:58:21

标签: jms ibm-mq

目前我正在使用Websphere MQ V8。

public static void main(String[] args) throws JMSException {
        // TODO Auto-generated method stub

        try{
            MQEnvironment.disableTracing();
            MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
            cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, "localhost");
            cf.setStringProperty(WMQConstants.WMQ_PORT, "1414");
            cf.setStringProperty(WMQConstants.WMQ_CHANNEL, "TEST_SVR_CONN");
            cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, "DEVTESTQUEUE");
            //cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_DIRECT_HTTP);
            //cf.setTransportType(WMQConstants.WMQ_CM_BINDINGS);
            //set MQServer = 
            //HelloWorldConsumer.HelloWorldProducer();
            MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection();
            MQSession session = (MQSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            MQQueue queue = (MQQueue) session.createQueue("REQUEST");
            //queue.setMessageBodyStyle(WMQConstants.WMQ_MESSAGE_BODY_MQ);
            queue.setTargetClient(WMQConstants.WMQ_TARGET_DEST_MQ);
            queue.setProperty("PROPCTL", "ALL");            
            ((com.ibm.mq.jms.MQQueue)queue).setIntProperty(WMQConstants.WMQ_TARGET_CLIENT, WMQConstants.WMQ_TARGET_DEST_MQ);
            connection.start();
            MessageConsumer consumer = session.createConsumer(queue);
            consumer.setMessageListener(new HelloWorldConsumer()); 
            session.close();                        
            connection.close();         
            System.out.println("------END------");          
         }catch(JMSException je){
            je.printStackTrace();
         }catch(Exception e){
            e.printStackTrace();
         }
    }

我试过将TARGCLIENT属性设置为WMQ_TARGET_DEST_MQ和PROPCTL为“NONE / FORCE”。我仍然得到消息中的标题为  RFH? ???? MQSTR? 25504.txt?上传| 1 ||

0 个答案:

没有答案