Skip to content

Instantly share code, notes, and snippets.

@balamuru
Created April 2, 2014 16:27
Show Gist options
  • Save balamuru/9937599 to your computer and use it in GitHub Desktop.
Save balamuru/9937599 to your computer and use it in GitHub Desktop.
package hello;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.util.FileSystemUtils;
import java.io.File;
public class Receiver {
/**
* Get a copy of the application context
*/
@Autowired
ConfigurableApplicationContext context;
/**
* When you receive a message, print it out, then shut down the application.
* Finally, clean up any ActiveMQ server stuff.
* @param obj
*/
public void handleMessage(Object obj) {
System.out.println("Received <" + obj + ">");
if ("close".equals(obj)) {
context.close();
FileSystemUtils.deleteRecursively(new File("activemq-data"));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment