Newbee here.  Doing a simple wholesaler and retaler jms example.

1) wholesaler creates a temporarytopic and subscribes to it.
2) when wholesaler publishes a message, it sets the message's JMSReplyTo to the 
temporaryTopic.

3) When retailer receives a message from wholesaler, it does some stuff and 
then based on calculations, it will publish a message to the 
message.getJMSReplyTo().  Here is the basic code snipets..

wholesaler:
            hotDealsTopic = (Topic) jndi.lookup("topic/Hot Deals");
            publisher = pubSession.createPublisher(hotDealsTopic);

            buyOrdersTopic = subSession.createTemporaryTopic();

            subscriber = subSession.createSubscriber(buyOrdersTopic);
            subscriber.setMessageListener(this);

when publishing:
            StreamMessage message = pubSession.createStreamMessage();
            message.writeString(dealDesc);
            message.writeString(itemDesc);
            message.writeFloat(oldPrice);
            message.writeFloat(newPrice);

            message.setStringProperty("Username", username);
            message.setStringProperty("Itemdesc", itemDesc);

            message.setJMSReplyTo(buyOrdersTopic);

            publisher.publish(message, DeliveryMode.PERSISTENT, 
Message.DEFAULT_PRIORITY,1800000);


Retailer: on Receive and process:

                TextMessage textMsg = session.createTextMessage();

                textMsg.setText(count + " " + itemDesc);

                Topic buyTopic = (Topic) message.getJMSReplyTo();
                publisher = session.createPublisher(buyTopic);

                textMsg.setJMSCorrelationID("DurableRetailer");

                publisher.publish(textMsg, DeliveryMode.PERSISTENT, 
Message.DEFAULT_PRIORITY, 1800000);


JMSSecurityException:
avax.jms.JMSSecurityException: Connection not authorized to addMessages to 
destination: JMS_TT5
        at 
org.jboss.mq.security.ServerSecurityInterceptor.addMessage(ServerSecurityInterceptor.java:167)
        at 
org.jboss.mq.server.TracingInterceptor.addMessage(TracingInterceptor.java:226)
        at 
org.jboss.mq.server.JMSServerInvoker.addMessage(JMSServerInvoker.java:112)
        at 
org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:111)
        at 
org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:395)
        at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:398)
        at 
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
        at java.lang.Thread.run(Thread.java:595)







View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031325#4031325

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031325
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to