Package org.apache.karaf.cellar.core.event

Examples of org.apache.karaf.cellar.core.event.EventConsumer


        if (requestProducer == null) {
            requestProducer = eventTransportFactory.getEventProducer(Constants.INTERFACE_PREFIX + Constants.SEPARATOR + endpoint.getId(), Boolean.FALSE);
            producers.put(endpoint.getId(), requestProducer);
        }

        EventConsumer resultConsumer = consumers.get(endpoint.getId());
        if (resultConsumer == null) {
            resultConsumer = eventTransportFactory.getEventConsumer(Constants.RESULT_PREFIX + Constants.SEPARATOR + clusterManager.getNode().getId() + endpoint.getId(), Boolean.FALSE);
            consumers.put(endpoint.getId(), resultConsumer);
        } else if (!resultConsumer.isConsuming()) {
            resultConsumer.start();
        }

        producers.put(endpoint.getId(), requestProducer);
        consumers.put(endpoint.getId(), resultConsumer);
View Full Code Here


    private void unimportService(EndpointDescription endpoint) {
        ServiceRegistration registration = registrations.get(endpoint);
        registration.unregister();

        producers.remove(endpoint.getId());
        EventConsumer consumer = consumers.remove(endpoint.getId());
        if (consumer != null) {
            consumer.stop();
        }
    }
View Full Code Here

    }

    public void destroy() {
        bundleContext.removeServiceListener(this);
            for(Map.Entry<String,EventConsumer> consumerEntry:consumers.entrySet()) {
                EventConsumer consumer = consumerEntry.getValue();
                consumer.stop();
            }
            consumers.clear();
    }
View Full Code Here

                    }

                    remoteEndpoints.put(endpointId, endpoint);

                    //Register the endpoint consumer
                    EventConsumer consumer = consumers.get(endpointId);
                    if(consumer == null) {
                        consumer = eventTransportFactory.getEventConsumer(Constants.INTERFACE_PREFIX + Constants.SEPARATOR + endpointId, false);
                        consumers.put(endpointId, consumer);
                    } else if(!consumer.isConsuming()) {
                        consumer.start();
                    }
                }
            }
        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
View Full Code Here

                    //If the endpoint is used for export from other nodes too, then put it back.
                    if(endpointDescription.getNodes().size() > 0) {
                        remoteEndpoints.put(endpointId,endpointDescription);
                    }

                    EventConsumer eventConsumer = consumers.remove(endpointId);
                    eventConsumer.stop();
                }
            }
        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
        }
View Full Code Here

        registerGroup(DEFAULT_GROUP);
    }

    public void destroy() {
        for(Map.Entry<String,EventConsumer> consumerEntry:groupConsumer.entrySet()) {
            EventConsumer consumer = consumerEntry.getValue();
            consumer.stop();
        }
        groupConsumer.clear();
        groupProducers.clear();
    }
View Full Code Here

            ServiceRegistration producerRegistration = bundleContext.registerService(EventProducer.class.getCanonicalName(), producer, serviceProperties);
            producerRegistrations.put(groupName, producerRegistration);
        }

        if (!consumerRegistrations.containsKey(groupName)) {
            EventConsumer consumer = groupConsumer.get(groupName);
            if(consumer == null) {
                consumer = eventTransportFactory.getEventConsumer(groupName,true);
                groupConsumer.put(groupName,consumer);
            } else if(!consumer.isConsuming()) {
                consumer.start();
            }
            ServiceRegistration consumerRegistration = bundleContext.registerService(EventConsumer.class.getCanonicalName(), consumer, serviceProperties);
            consumerRegistrations.put(groupName, consumerRegistration);
        }
View Full Code Here

            }
        }

        //4. Remove Consumers & Producers
        groupProducers.remove(groupName);
        EventConsumer consumer = groupConsumer.remove(groupName);
        if(consumer != null) {
            consumer.stop();
        }



        //Remove group from configuration
View Full Code Here

            group.getNodes().remove(local);
            listGroups().put(groupName, group);
        }
        // shutdown the group consumer/producers
        for (Map.Entry<String,EventConsumer> consumerEntry : groupConsumer.entrySet()) {
            EventConsumer consumer = consumerEntry.getValue();
            consumer.stop();
        }
        groupConsumer.clear();
        groupProducers.clear();
    }
View Full Code Here

            ServiceRegistration producerRegistration = bundleContext.registerService(EventProducer.class.getCanonicalName(), producer, serviceProperties);
            producerRegistrations.put(groupName, producerRegistration);
        }

        if (!consumerRegistrations.containsKey(groupName)) {
            EventConsumer consumer = groupConsumer.get(groupName);
            if(consumer == null) {
                consumer = eventTransportFactory.getEventConsumer(groupName,true);
                groupConsumer.put(groupName,consumer);
            } else if(!consumer.isConsuming()) {
                consumer.start();
            }
            ServiceRegistration consumerRegistration = bundleContext.registerService(EventConsumer.class.getCanonicalName(), consumer, serviceProperties);
            consumerRegistrations.put(groupName, consumerRegistration);
        }
View Full Code Here

TOP

Related Classes of org.apache.karaf.cellar.core.event.EventConsumer

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.