Package net.timewalker.ffmq3.common.message

Examples of net.timewalker.ffmq3.common.message.TextMessageImpl


    /* (non-Javadoc)
     * @see javax.jms.Session#createTextMessage(java.lang.String)
     */
    public final TextMessage createTextMessage(String text) throws JMSException
    {
        return new TextMessageImpl(text);
    }
View Full Code Here


   
    long start = System.currentTimeMillis();
    int msgCount = 178;
    for (int i = 0; i < msgCount; i++)
    {
      AbstractMessage msg = new TextMessageImpl("msg"+i);
      msg.setJMSMessageID("ID:FOO"+i);
      msg.setJMSPriority(rand.nextInt(10));
      assertTrue(msgStore.store(msg) != -1);
      //msgStore.commitChanges();
    }
    msgStore.commitChanges();
    long end = System.currentTimeMillis();
    System.out.println("testPriorityBasic: "+(end-start));
    assertEquals(msgCount, msgStore.size());
   
    assertOrdered(msgStore);
   
    // Delete half the queue
    int count = 0;
    int current = msgStore.first();
    while (current != -1 && count < (msgCount/2))
    {
      int next = msgStore.next(current);
      msgStore.delete(current);
      count++;
      current = next;
    }
    msgStore.commitChanges();
    assertEquals(msgCount/2, msgStore.size());
   
    assertOrdered(msgStore);
   
    //System.out.println(msgStore.toString());
   
    for (int i = 0; i < msgCount/2; i++)
    {
      AbstractMessage msg = new TextMessageImpl("other_msg"+i);
      msg.setJMSMessageID("ID:BAR"+i);
      msg.setJMSPriority(rand.nextInt(10));
      assertTrue(msgStore.store(msg) != -1);
    }
    msgStore.commitChanges();
    assertEquals(msgCount, msgStore.size());
   
View Full Code Here

  {
    MessageStore msgStore = createMessageStore();

    for (int i = 0; i < 10; i++)
    {   
      AbstractMessage msg = new TextMessageImpl("msg"+i);
      msg.setJMSMessageID("ID:FOO"+i);
      msg.setJMSPriority(i);
      msg.setJMSCorrelationID("ID"+i);
      msgStore.store(msg);
      msgStore.commitChanges();
    }
    assertEquals(10, msgStore.size());
   
    assertOrdered(msgStore);
   
    int current = msgStore.first();
    for(int n=0;n<5;n++)
      current = msgStore.next(current);
    Message removedMsg = msgStore.retrieve(current);
    msgStore.delete(current);
    msgStore.commitChanges();
   
    assertOrdered(msgStore);
   
    AbstractMessage msg = new TextMessageImpl("msgNEW");
    msg.setJMSMessageID("ID:XXX");
    msg.setJMSPriority(removedMsg.getJMSPriority()+1);
    msgStore.store(msg);
    msgStore.commitChanges();
   
    msg = new TextMessageImpl("msgNEW2");
    msg.setJMSMessageID("ID:YYY");
    msg.setJMSPriority(removedMsg.getJMSPriority());
    msgStore.store(msg);
    msgStore.commitChanges();
   
    //System.out.println(msgStore);
   
View Full Code Here

        "undefined in (1,2)",
    };
   
    private Message getTestMessage() throws Exception
    {
      Message msg = new TextMessageImpl();
      msg.setStringProperty("sProp", "foobar");
      msg.setIntProperty("iProp", 1);
      msg.setIntProperty("iProp2", 2);
      msg.setIntProperty("lProp", 3);
      msg.setFloatProperty("fProp", 1.23f);
      msg.setDoubleProperty("dProp", 4.56);
      msg.setBooleanProperty("bProp", true);
      return msg;
    }
View Full Code Here

                                                TestUtils.TEST_SERVER_PORT,
                                                settings);
            }
            else
            {
                listener = new TcpListener(engine,
                                           FFMQConstants.DEFAULT_SERVER_HOST,
                                           TestUtils.TEST_SERVER_PORT,
                                           settings);
            }
           
View Full Code Here

          if (isRemote())
          {
            boolean useNIO = settings.getBooleanProperty("listener.tcp.useNIO",false);
            if (useNIO)
            {
              listener = new NIOTcpListener(engine,
                                                FFMQConstants.DEFAULT_SERVER_HOST,
                                                TestUtils.TEST_SERVER_PORT,
                                                settings);
            }
            else
View Full Code Here

          hasCreatedASession = true;
          ActivityWatchdog.getInstance().unregister(this);
        }
       
        // Use an internal hook to bridge the local session to the remote peer
        localSession.setNotificationProxy(new RemoteNotificationProxy(localSession.getId(),transport));
       
        return new CreateSessionResponse();
    }
View Full Code Here

          catch (JMSException e)
          {
              // Ignore
          }
         
          engine = new FFMQEngine(TestUtils.LOCAL_ENGINE_NAME,settings,null);
          engine.deploy();
         
//          engine.deleteQueue("TEST1");
//          engine.deleteQueue("TEST2");
//          engine.deleteTopic("TEST1");
View Full Code Here

   
    protected final void initDestination() throws JMSException
    {
        // Security : a consumer destination may only be set at creation time
        //            so we check permissions here once and for all.
        LocalConnection conn = (LocalConnection)session.getConnection();
        if (conn.isSecurityEnabled())
        {
            if (destination instanceof Queue)
            {
                String queueName = ((Queue)destination).getQueueName();
                if (conn.isRegisteredTemporaryQueue(queueName))
                {
                    // OK, temporary destination
                }
                else
                if (queueName.equals(FFMQConstants.ADM_REQUEST_QUEUE))
                {
                    // Only the internal admin thread can consume on this queue
                    if (conn.getSecurityContext() != null)
                        throw new FFMQException("Access denied to administration queue "+queueName,"ACCESS_DENIED");
                }
                else
                if (queueName.equals(FFMQConstants.ADM_REPLY_QUEUE))
                {
                    conn.checkPermission(Resource.SERVER, Action.REMOTE_ADMIN);
                }
                else
                {
                    // Standard queue
                    conn.checkPermission(destination,Action.CONSUME);
                }
            }
            else
            if (destination instanceof Topic)
            {
                String topicName = ((Topic)destination).getTopicName();
                if (conn.isRegisteredTemporaryTopic(topicName))
                {
                    // OK, temporary destination
                }
                else
                {
                    // Standard topic
                    conn.checkPermission(destination,Action.CONSUME);
                }
            }
        }
       
        // Lookup a local destination object from the given reference
View Full Code Here

        return new CloseConsumerResponse();
    }
   
    private RollbackMessageResponse processRollbackMessage( RollbackMessageQuery query ) throws JMSException
    {
      LocalConnection localConnection = getLocalConnection();
     
        LocalSession localSession = (LocalSession)localConnection.lookupRegisteredSession(query.getSessionId());
        if (localSession != null)
        {
            // Rollback undelivered prefetched messages
            List undeliveredMessageIDs = new ArrayList();
            undeliveredMessageIDs.add(query.getMessageId());
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.common.message.TextMessageImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.