Three data synchronization between the system in the system using WebService and JMS

The structure diagram of the jmsclient system is as follows:

The spring configuration file is as follows:

< ?xml version="1.0" encoding="UTF-8"?>
xmlns:context="http: //www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http:// www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/ context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">



class="org.springframework.jndi.JndiTemplate">



org.apache.activemq.jndi.ActiveM QInitialContextFactory

tcp://10.78.69.50:61616
system
manager





class="org.springframework. jndi.JndiObjectFactoryBean">


< br />

class="org.springframework.jms.connection.CachingConnectionFactory">















< br />



















The contents of the DataListener are as follows:

package com.test; 

import com.test.model.User;

public class DataListener
{
public void handleMessage(User message)
{< br /> System.out.println("DataListener: "+ message);
}

public void handleMessage(Object message)
{
System.out. println("DataListener: "+ message);
}

public void handleMessage(String message)
{
System.out.println(message);
}
}

The content of RestfulDataListener is as follows:

package com.test;
import javax.jms.JMSException;
import javax .jms.Session;
import javax.jms.TextMessage;

import org.springframework.jms.listener.SessionAwareMessageListener;


public class RestfulDataListener implements SessionAwareMessageListener
{

public void onMessage(TextMessage message, Session session) throws JMSException
{
System.out.println("Receive Restful Message: "+ message.getText());
}

}

The content of jndi.properties is as follows:

​< /p>

java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url = tcp://10.78.69.50:61616
java. naming.security.principal = system
java.naming.security.crede ntials = manager
connectionFactoryNames = QueueCF
queue.queue1=jms.queue1
queue.queue2=jms.queue2

Leave a Comment

Your email address will not be published.