title: message service with relay behaviour
body: <p>I'm designing a distributed network of sensing device. These devices will generate logs and send them to a central database. I'm using JMS for transporting log messages. The main database server will be running MDB(Message Driven Bean) to process incoming messages. The clients are sending data with GPRS. The problem is I don't want my clients to process network problems. I need some relay service that runs locally on client machine and gets the message from client immediately without blocking it and try on behalf of it.(if network is down, try sending again after some time).</p>
  
  <p>message is a simple java object:</p>
  
  <pre><code>public class Message {
      public int x;
      public int y;
      public int z;
  }
  </code></pre>
  
  <p>client:</p>
  
  <pre><code>Message msg = new Message();
  while (True) {
      /* sense data */
      msg = get_data_from_environment();
  
      /* send data to local relay service
       * This is non blocking call */
      relay_service.send(msg);
  }
  </code></pre>
  
  <p>local relay service:</p>
  
  <pre><code>while (True) {
      /* get message from local client */
      msg = get_message_from_local_client();
  
      result = send_msg_to_JMS_server(msg);
  
      /* if not successful, persist it on a local queue and try some other time */
      if (result.is_sent() != True)
          store_msg_on_disk(msg);
  }
  </code></pre>
  
  <p>Is there a message service like this or I should write relay service myself?</p>
  
  <p>is this good to use JMS in this case? Should I design my own socket level protocol to send messages?</p>