Package com.hazelcast.queue.impl.client

Examples of com.hazelcast.queue.impl.client.AddListenerRequest


        super(serviceName, name);
        this.name = name;
    }

    public String addItemListener(final ItemListener<E> listener, final boolean includeValue) {
        final AddListenerRequest request = new AddListenerRequest(name, includeValue);
        EventHandler<PortableItemEvent> eventHandler = new EventHandler<PortableItemEvent>() {
            public void handle(PortableItemEvent portableItemEvent) {
                E item = includeValue ? (E) getContext().getSerializationService().toObject(portableItemEvent.getItem()) : null;
                Member member = getContext().getClusterService().getMember(portableItemEvent.getUuid());
                ItemEvent<E> itemEvent = new ItemEvent<E>(name, portableItemEvent.getEventType(), item, member);
View Full Code Here


            }
        };
        constructors[ADD_LISTENER] = new ConstructorFunction<Integer, Portable>() {
            @Override
            public Portable createNew(Integer arg) {
                return new AddListenerRequest();
            }
        };
        constructors[REMAINING_CAPACITY] = new ConstructorFunction<Integer, Portable>() {
            @Override
            public Portable createNew(Integer arg) {
View Full Code Here

    }

    @Test
    public void testAddListener() throws IOException {
        final SimpleClient client = getClient();
        client.send(new AddListenerRequest(queueName, true));
        client.receive();
        getQueue().offer("item");

        PortableItemEvent result = (PortableItemEvent) client.receive();
        assertEquals("item", ss.toObject(result.getItem()));
View Full Code Here

TOP

Related Classes of com.hazelcast.queue.impl.client.AddListenerRequest

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.