Skip to content

Instantly share code, notes, and snippets.

@emag
Created December 23, 2013 10:39
Show Gist options
  • Save emag/8094870 to your computer and use it in GitHub Desktop.
Save emag/8094870 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 message
*/
public void receiveMessage(String message) {
System.out.println("Received <" + message + ">");
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