When you start an ActiveMQ broker, it creates two “data” folders in its home directory called activemq-data and data. The former is used for temporary storage and the data folder is where it keeps its log — activemq.log — file.
When you start an ActiveMQ broker, it creates two “data” folders in its home directory called activemq-data and data. The former is used for temporary storage and the data folder is where it keeps its log — activemq.log — file.
September 14, 2010 at 4:18 pm |
Hi,
I am trying to run a web application based on spring consisting of standalone AMQ & Tomcat. I am not able to see my message being produced/consumed anywhere. This is my code:
TopicSender
=========
import java.io.Serializable;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.Topic;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
public class TopicMessageSender {
private JmsTemplate jmsTemplate;
private Topic topic;
public void produce(final Serializable object) {
System.out.println(“inside produce”);
this.jmsTemplate.send(this.topic, new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
ObjectMessage mm = session.createObjectMessage();
mm.setObject(object);
return mm;
}
});
}
@Required
public void setJmsTemplate(JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate;
}
@Required
public void setTopic(Topic topic) {
this.topic = topic;
}
}
TopicMessageListener1
==================
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
public class TopicMessageListener1 implements MessageListener{
@Override
public void onMessage(Message message) {
try {
if (message instanceof ObjectMessage) {
ObjectMessage mapMessage = (ObjectMessage) message;
Object obj = mapMessage.getObject();
System.out.println(“Printing from Subs1″+obj);
}
} catch (Exception e) {
// handle exception
}
}
}
Employee
=========
import java.io.Serializable;
import java.util.Date;
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
String lName=”Garg”;
String fName=”Kshitiz”;
double salary = 25000;
Date hireDate = new Date();
String address=”Gurgaon”;
public String getlName() {
return lName;
}
public void setlName(String lName) {
this.lName = lName;
}
public String getfName() {
return fName;
}
public void setfName(String fName) {
this.fName = fName;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public java.util.Date getHireDate() {
return hireDate;
}
public void setHireDate(java.util.Date hireDate) {
this.hireDate = hireDate;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
Relevant config file settings
====================
tcp://localhost:61616
I am not able to figure out the exact problem. Can you please help me ?