IBM MQ學習過程問題匯總


IBM MQ使用過程問題匯總
----------------------------------------------
1. 客戶端發送消息時出現2035問題的解決過程
####環境:win7系統administrator用戶,WebSphereMQ8.0
####測試:執行命令"amqsputc.exe Q1"
a---按照教程添加"服務器連接"通道時為MCA指定用戶名。無效;
b---執行runmqsc命令,輸入alter qmgr chlauth(disabled)禁止權限驗證。無效;
c---具體隊列管理器/屬性/擴展/連接認證(在最后一行),刪除。無效;
d---執行runmqsc命令,輸入refresh security type(connauth)刷新告訴緩存。生效;
結論:終極解決方案就是依次執行b、c、d步驟。
----------------------------------------------
2. 客戶端如何獲取消息?
    客戶端調用類似MQGET的方法獲得消息,可以設置立即返回或者阻塞等待,如果是阻塞等待又可以設置超時。
3. 如何發送文件?
    發送端需要先將文件內容轉成字節流,然后將字節流打入消息對象中,然后發送;
    接收端接收到消息對象后,將文件內容字節流寫入目的文件中;
4. 如何設置消息持久化、非持久化?
    queueSender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

5. 遠程管理隊列管理器
    通道/新建/服務器連接通道/SYSTEM.ADMIN.SVRCONN;
    一般Unix、Linux平台中MQ默認的字符集為819,而Windows平台為1381;

----------------------------------------------
6. WMQ與AMQ之間如何建立橋接?
    使用AMQ內置的camel實現:
    下載apache-activemq-5.13.1-bin.zip並解壓;
    安裝WMQ8.0;
    將WMQ下Java/lib目錄下的jar包拷貝到AMQ的lib目錄下;
    修改camel.xml配置文件拷貝到conf目錄下;
    啟動activemq,測試橋接;

<beans
   xmlns="http://www.springframework.org/schema/beans"  
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
     http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
  
    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

        <!-- You can use Spring XML syntax to define the routes here using the <route> element -->
        <route>
            <description>Example Camel Route</description>
            <from uri="activemq:example.A"/>
            <to uri="wasmq:Q2"/>
        </route>
    </camelContext>

    <!--
       Lets configure some Camel endpoints
    
       http://camel.apache.org/components.html
    -->

    <!-- configure the camel activemq component to use the current broker -->
    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
        <property name="connectionFactory">
          <bean class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="vm://localhost?create=true"/>
            <property name="userName" value="${activemq.username}"/>
            <property name="password" value="${activemq.password}"/>
          </bean>
        </property>
    </bean>
    <bean id="activemq1" class="org.apache.activemq.camel.component.ActiveMQComponent" >
        <property name="connectionFactory">
          <bean class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="tcp://localhost:61616"/>
            <property name="userName" value="${activemq.username}"/>
            <property name="password" value="${activemq.password}"/>
          </bean>
        </property>
    </bean>
    <bean id="wasmq" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory">
            <bean  class="com.ibm.mq.jms.MQQueueConnectionFactory">
                <property name="transportType" value="1" />
                <property name="hostName" value="192.168.51.183" />
                <property name="port" value="1414" />
                <property name="queueManager" value="QM_ORANGE" />
                <property name="channel" value="CLIENT.QM_ORANGE" />
                <property name="useConnectionPooling" value="true" />
            </bean>   
        </property>
    </bean>

</beans>
View Code

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM