Examples of MessageContainer


Examples of com.netflix.suro.message.MessageContainer

        assertEquals("sink1", route.getSink());

        Map<String, Map<String, String>> obj = Maps.newHashMap();
        obj.put("foo", ImmutableMap.of("bar", "tESt"));

        MessageContainer container = Mockito.mock(MessageContainer.class);
        Mockito.when(container.getEntity(Map.class)).thenReturn(obj);
        assertEquals(true, route.getFilter().doFilter(container));
    }
View Full Code Here

Examples of com.netflix.suro.message.MessageContainer

public class FilterTestUtil {
    private static final Splitter PATH_SPLITTER = Splitter.on("/").omitEmptyStrings().trimResults();

    // Returns a message container that has the given routing key , and payload that has the given path and given value
    public static MessageContainer makeMessageContainer(String routingKey, String path, Object value) throws Exception {
        MessageContainer container = mock(MessageContainer.class);
        when(container.getRoutingKey()).thenReturn(routingKey);

        if(path == null) {
            return container;
        }
        List<String> steps = Lists.newArrayList(PATH_SPLITTER.split(path));
        Map<String, Object> map = Maps.newHashMap();
        Map<String, Object> current = map;

        for(int i = 0; i < steps.size() - 1; i++) {
            String step = steps.get(i);
            Map<String, Object> obj = Maps.newHashMap();
            current.put(step, obj);
            current = obj;
        }
        current.put(steps.get(steps.size() - 1), value);

        when(container.getEntity(Map.class)).thenReturn(map);

        return container;
    }
View Full Code Here

Examples of com.netflix.suro.message.MessageContainer

public class RoutingKeyFilterTest {
    @Test
    public void testDoFilter() throws Exception {
        RoutingKeyFilter filter = new RoutingKeyFilter("(?i)key");

        MessageContainer container = makeMessageContainer("routingkEYname", null, null);

        assertTrue(filter.doFilter(container));
    }
View Full Code Here

Examples of com.netflix.suro.message.MessageContainer

    @Test
    public void negativeTest() throws Exception {
        RoutingKeyFilter filter = new RoutingKeyFilter("nomatch");

        MessageContainer container = makeMessageContainer("routingkey", null, null);

        assertFalse(filter.doFilter(container));
    }
View Full Code Here

Examples of org.activemq.service.MessageContainer

        ActiveMQDestination dest = (ActiveMQDestination) message.getJMSDestination();
        if (dest != null && dest.isTopic() && message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT) {
            // note that we still need to persist the message even if there are no matching
            // subscribers as they may come along later
            // plus we don't pre-load subscription information               
            final MessageContainer container = getContainer(dest.getPhysicalName());
            container.addMessage(message);
            TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    doSendMessage(client, message, container);
                }
            });
View Full Code Here

Examples of org.activemq.service.MessageContainer

        ActiveMQDestination dest = (ActiveMQDestination) message.getJMSDestination();
        if (dest != null && dest.isTopic() && message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT) {
            // note that we still need to persist the message even if there are no matching
            // subscribers as they may come along later
            // plus we don't pre-load subscription information               
            final MessageContainer container = getContainer(dest.getPhysicalName());
            container.addMessage(message);
            TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    doSendMessage(client, message, container);
                }
            });
View Full Code Here

Examples of org.activemq.service.MessageContainer

            firstException = e;
        }

        // lets stop all the containers
        for (Iterator iter = messageContainers.values().iterator(); iter.hasNext();) {
            MessageContainer container = (MessageContainer) iter.next();
            try {
                container.stop();
            }
            catch (JMSException e) {
                if (firstException == null) {
                    firstException = e;
                }
View Full Code Here

Examples of org.activemq.service.MessageContainer

        }

    }

    public synchronized MessageContainer getContainer(String destinationName) throws JMSException {
        MessageContainer container = (MessageContainer) messageContainers.get(destinationName);
        if (container == null) {
            container = createContainer(destinationName);
            container.start();
            messageContainers.put(destinationName, container);

            destinations.put(destinationName, createDestination(destinationName));
        }
        return container;
View Full Code Here

Examples of org.activemq.service.MessageContainer

    }
   
    synchronized public Map getMessageContainerAdmins() {
        HashMap map = new HashMap(messageContainers.size());
        for (Iterator iter = messageContainers.values().iterator(); iter.hasNext();) {
            MessageContainer mc = (MessageContainer) iter.next();
            map.put(mc.getDestinationName(), mc.getMessageContainerAdmin());           
        }
        return Collections.unmodifiableMap(map);
    }
View Full Code Here

Examples of org.activemq.service.MessageContainer

        return Collections.unmodifiableMap(map);
    }
   

    public synchronized void destroyMessageContainer(ActiveMQDestination dest) throws JMSException {
        MessageContainer container = (MessageContainer) messageContainers.get(dest.getPhysicalName());
        if (container != null) {
            container.getMessageContainerAdmin().empty();
            container.stop();
            messageContainers.remove(dest.getPhysicalName());
            destinations.remove(dest.getPhysicalName());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.