Created
April 2, 2014 16:27
-
-
Save balamuru/9937599 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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