Package org.hornetq.api.core

Examples of org.hornetq.api.core.HornetQBuffer


         for (int i = 0; i < numberOfMessages; i++)
         {
            message = session.createMessage(true);

            HornetQBuffer bodyLocal = message.getBodyBuffer();

            bodyLocal.writeBytes(body);

            message.putIntProperty(new SimpleString("id"), i);

            producer.send(message);
            if (i % 1000 == 0)
            {
               session.commit();
            }
         }
         session.commit();
         session.close();

         session = null;

         sf.close();
         locator.close();

         server.stop();

         server = createServer(true,
                               config,
                               PagingTest.PAGE_SIZE,
                               PagingTest.PAGE_MAX,
                               new HashMap<String, AddressSettings>());
         server.start();

         locator = createInVMNonHALocator();
         sf = locator.createSessionFactory();

         Queue queue = server.locateQueue(ADDRESS);

         assertEquals(numberOfMessages, queue.getMessageCount());

         LinkedList<Xid> xids = new LinkedList<Xid>();

         int msgReceived = 0;
         ClientSession sessionConsumer = sf.createSession(false, false, false);
         sessionConsumer.start();
         ClientConsumer consumer = sessionConsumer.createConsumer(PagingTest.ADDRESS);
         for (int msgCount = 0; msgCount < numberOfMessages; msgCount++)
         {
            log.info("Received " + msgCount);
            msgReceived++;
            ClientMessage msg = consumer.receiveImmediate();
            if (msg == null)
            {
               log.info("It's null. leaving now");
               sessionConsumer.commit();
               fail("Didn't receive a message");
            }
            msg.acknowledge();

            if (msgCount % 5 == 0)
            {
               log.info("commit");
               sessionConsumer.commit();
            }
         }

         sessionConsumer.commit();

         sessionConsumer.close();

         sf.close();

         locator.close();

         assertEquals(0, queue.getMessageCount());

         long timeout = System.currentTimeMillis() + 5000;
         while (timeout > System.currentTimeMillis() && queue.getPageSubscription().getPagingStore().isPaging())
         {
            Thread.sleep(100);
         }
         assertFalse(queue.getPageSubscription().getPagingStore().isPaging());

         server.stop();

         // Deleting the paging data. Simulating a failure
         // a dumb user, or anything that will remove the data
         deleteDirectory(new File(getPageDir()));

         server = createServer(true,
                               config,
                               PagingTest.PAGE_SIZE,
                               PagingTest.PAGE_MAX,
                               new HashMap<String, AddressSettings>());
         server.start();

         locator = createInVMNonHALocator();
         locator.setBlockOnNonDurableSend(true);
         locator.setBlockOnDurableSend(true);
         locator.setBlockOnAcknowledge(true);

         sf = locator.createSessionFactory();

         queue = server.locateQueue(ADDRESS);

         sf = locator.createSessionFactory();
         session = sf.createSession(false, false, false);

         producer = session.createProducer(PagingTest.ADDRESS);

         for (int i = 0; i < numberOfMessages; i++)
         {
            message = session.createMessage(true);

            HornetQBuffer bodyLocal = message.getBodyBuffer();

            bodyLocal.writeBytes(body);

            message.putIntProperty(new SimpleString("id"), i);

            producer.send(message);
            if (i % 1000 == 0)
View Full Code Here


         for (int i = 0; i < numberOfMessages; i++)
         {
            message = session.createMessage(true);

            HornetQBuffer bodyLocal = message.getBodyBuffer();

            bodyLocal.writeBytes(body);

            message.putIntProperty(new SimpleString("id"), i);

            producer.send(message);
            if (i % messagesPerTX == 0)
View Full Code Here

         for (int i = 0; i < numberOfMessages; i++)
         {
            message = session.createMessage(true);

            HornetQBuffer bodyLocal = message.getBodyBuffer();

            bodyLocal.writeBytes(body);

            message.putStringProperty("id", "str-" + i);

            producer.send(message);
            if ((i + 1) % messagesPerTX == 0)
View Full Code Here

         for (int i = 0; i < numberOfMessages; i++)
         {
            message = session.createMessage(persistentMessages);

            HornetQBuffer bodyLocal = message.getBodyBuffer();

            bodyLocal.writeBytes(body);

            message.putIntProperty(new SimpleString("id"), i);

            producer.send(message);
            if (i % 1000 == 0)
View Full Code Here

                  log.info("Sent " + i + " messages");
                  session.commit();
               }
               message = session.createMessage(true);

               HornetQBuffer bodyLocal = message.getBodyBuffer();

               bodyLocal.writeBytes(body);

               message.putIntProperty(new SimpleString("id"), i);

               producer.send(message);
            }
View Full Code Here

               {
                  session.commit();
               }
               message = session.createMessage(true);

               HornetQBuffer bodyLocal = message.getBodyBuffer();

               bodyLocal.writeBytes(body);

               message.putIntProperty(new SimpleString("id"), i);

               producer.send(message);
            }
View Full Code Here

         for (int i = 0; i < numberOfMessages; i++)
         {
            message = session.createMessage(persistentMessages);

            HornetQBuffer bodyLocal = message.getBodyBuffer();

            bodyLocal.writeBytes(body);

            message.putIntProperty(new SimpleString("id"), i);

            producer.send(message);
         }
View Full Code Here

         for (int i = 0; i < numberOfMessages; i++)
         {
            message = session.createMessage(true);

            HornetQBuffer bodyLocal = message.getBodyBuffer();

            for (int j = 1; j <= numberOfIntegers; j++)
            {
               bodyLocal.writeInt(j);
            }

            message.putIntProperty(new SimpleString("id"), i);

            producer.send(message);
View Full Code Here

         for (int i = 0; i < numberOfMessages; i++)
         {
            message = session.createMessage(true);

            HornetQBuffer bodyLocal = message.getBodyBuffer();

            for (int j = 1; j <= numberOfIntegers; j++)
            {
               bodyLocal.writeInt(j);
            }

            message.putIntProperty(new SimpleString("id"), i);

            producer.send(message);
View Full Code Here

         for (int i = 0; i < numberOfMessages; i++)
         {
            message = session.createMessage(true);

            HornetQBuffer bodyLocal = message.getBodyBuffer();

            bodyLocal.writeBytes(new byte[1024]);

            message.putIntProperty(new SimpleString("id"), i);

            producer.send(message);
         }
View Full Code Here

TOP

Related Classes of org.hornetq.api.core.HornetQBuffer

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.