views:

160

answers:

1

I use ActiveMQ as Notification System(Pub/Sub model). On server: if any changes of data occur, Server send this updated data (File) to Topic using BlobMessages. There are few Clients, that subscribe on this Topic and get updated File if it exsist in Topic.


The problem is that all of BlobMessages, that were sent to Topic, are hold by ActiveMQ all time.


this.producer = new ProducerTool.Builder("tcp://localhost:61616?jms.blobTransferPolicy.uploadUrl=http://localhost:8161/fileserver/",
                "ServerProdTopic").topic(true)
                .transacted(false).durable(false).timeToLive(10000L).build();
this.consumer = new ConsumerTool.Builder("tcp://localhost:61616", "ServerConsTopic").topic(true)
                .transacted(false).durable(false).build();

        consumer.setMessageListener(this);

The File is sent:


connection = createConnection();
session = createSession(connection);
producer = createProducer(session);
BlobMessage blobMsg = ((ActiveMQSession) session).createBlobMessage(resource);
blobMsg.setStringProperty("sourceName", resource.getName());

producer.send(blobMsg);
if (transacted) {
    System.out.println("Producer Committing...");
    session.commit();
}

Where createProducer is:


protected Connection createConnection() throws JMSException, Exception {
   ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);
   //connectionFactory.getBlobTransferPolicy().setUploadUrl("http://localhost:8161/fileserver/");
   Connection connection = connectionFactory.createConnection();
    connection.start();
    ((ActiveMQConnection) connection).setCopyMessageOnSend(false);
    return connection;
}

All, that could be useful I set as need: Session.AUTO_ACKNOWLEDGE; Non-Durable Subscription; TimeToLive = 9000; JMSDeliveryMode = Non-Persistent;


What I have at runtime: in ActiveMQ directory: ~/apache-activemq-5.3.0/webapps/fileserver/ tere are all File, that where delivered and not delivered to Subscribers. Why? Sometimes Server send Big Files about 1 GB....And even this Files are hold at that directory, Even after stopping Subscribers(Clients), Publisher(Server) and ActiveMQ Broker.

A: 

Hi, I am facing a similar problem. Did you find any solution for this?

Abhishek