title: Is it possible to run a long task using Spring Boot?
body: <p>I would like to run several long tasks with Spring Boot using a TaskExecutor.  I want to have multiple rfid readers running and getting tags of items continuously.  Then I need to use these tags to update the database. So far I have not been able to get the tasks running more than one time using Spring Boot. Is this possible?</p>
  
  <p>I'm creating a @Component reader class.  When creating I start the listener service and the listener to keep track of the tags. I have the startMessageService and the setReaderConfig methods.  The first method I start the message listener service to receive the messages with the tag info from the reader when it comes in.  The second method sets up the reader to read autonomously so when the tags go by the reader, the reader sends a message to the listener and I receive the message.</p>
  
  <p>The run method basically keeps the reader going to read when the messages come in.  But for some reason the code is not working how I want it to.  As soon as the reader has a tag come by I should receive a message and I'm not. </p>
  
  <p>At the bottom is my threadpooltaskexecutor bean.  </p>
  
  <p>I'm not sure what I'm missing. </p>
  
  <pre><code>@Component
  @Scope("prototype")
  public class AlienReader extends AlienClass1Reader implements 
  TagTableListener, MessageListener, Runnable{
   private String ipaddress;
   private int port;
   private String username;
   private String password;
   int serviceport;
  
  public AlienReader(String ipaddress, int port, String username, String pwd, 
  int serviceport) throws UnknownHostException, AlienReaderException, 
  InterruptedException{
      super(ipaddress, port);
      this.ipaddress=ipaddress;
      this.port=port;
      this.username=username;
      this.password=pwd;
      this.serviceport=serviceport;
      startMessageService();
      setReaderConfig();
  
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>@Bean
  public ThreadPoolTaskExecutor threadPoolTaskExecutor(){
      ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
      executor.setCorePoolSize(15);
      executor.setMaxPoolSize(42);
      executor.setQueueCapacity(11);
      executor.setThreadNamePrefix("threadPoolExecutor-");
      executor.setWaitForTasksToCompleteOnShutdown(true);
      executor.initialize();
      return executor;
  }
  </code></pre>