Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove configuration-api,configuration-lib and monitoring #79

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions queue-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<groupId>com.cisco.oss.foundation.queue</groupId>
<artifactId>queue-api</artifactId>
<name>queue-api</name>
<version>1.1.1-1-SNAPSHOT</version>
<version>2.0.0-1-SNAPSHOT</version>
<description>This project defines common api for queue api for foundation runtime software</description>
<url>https://github.com/foundation-runtime/communication/tree/master/queue-api</url>
<issueManagement>
Expand Down Expand Up @@ -82,15 +82,33 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.cisco.oss.foundation</groupId>
<artifactId>configuration-api</artifactId>
<version>1.0.2-1</version>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring-version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.cisco.oss.foundation</groupId>
<artifactId>monitoring-api</artifactId>
<version>1.0.2-1</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<scope>provided</scope>
</dependency>
<!--<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring-version}</version>
</dependency>-->
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@

package com.cisco.oss.foundation.message;

import com.cisco.oss.foundation.configuration.ConfigurationFactory;
import org.apache.commons.configuration.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Component
abstract class AbstractMessageDispatcher implements MessageDispatcher {

private static final Logger LOGGER = LoggerFactory.getLogger(MessageDispatcher.class);
Expand All @@ -36,13 +39,18 @@ abstract class AbstractMessageDispatcher implements MessageDispatcher {
private ExecutorService executorService;
private CapacityEnsurableLinkedBlockingQueue<Runnable> blockingWaitingQueue;

@Autowired
private Environment environment;

@Value("${"+MessageConstants.QUEUE_SIZE_PROPERTY+"}")
private int maxThreadPoolSize=0;

@Value("${"+MessageConstants.WAITING_QUEUE_SIZE_PROPERTY+"}")
private int waitingQueueSize=0;

public AbstractMessageDispatcher(ConcurrentMessageHandler concurrentMessageHandler){
this.concurrentMessageHandler = concurrentMessageHandler;

Configuration configuration = ConfigurationFactory.getConfiguration();
int maxThreadPoolSize = configuration.getInt(MessageConstants.QUEUE_SIZE_PROPERTY);
int waitingQueueSize = configuration.getInt(MessageConstants.WAITING_QUEUE_SIZE_PROPERTY);

waitingList = new CopyOnWriteArrayList<Message>();
try {
if (waitingQueueSize > 0){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,25 @@

package com.cisco.oss.foundation.message;

import com.cisco.oss.foundation.configuration.ConfigurationFactory;
import com.cisco.oss.foundation.monitoring.CommunicationInfo;
import com.cisco.oss.foundation.monitoring.services.ServiceDetails;
import org.apache.commons.configuration.Configuration;

/**
* Created by Yair Ogen on 15/06/2014.
*/
public abstract class AbstractMessageHandler implements MessageHandler {

private String consumerName;
private ServiceDetails serviceDetails = new ServiceDetails(getServiceDescription(),consumerName,getProtocol(),-1);

public AbstractMessageHandler(String consumerName){
this.consumerName = consumerName;
}

// @Override
public void preMessageProcessing(Message message) {
if(isMonitoringEnabled()){
CommunicationInfo.INSTANCE.transactionStarted(serviceDetails,consumerName);
}
}

// @Override
public void postMessageProcessing(Message message) {
if(isMonitoringEnabled()){
CommunicationInfo.INSTANCE.transactionFinished(serviceDetails,consumerName,false, "N/A");
}
}

private boolean isMonitoringEnabled() {
Configuration configuration = ConfigurationFactory.getConfiguration();
Configuration subset = configuration.subset(consumerName);
boolean isMonitoringEnabled = subset.getBoolean("queue.isMonitoringEnabled",false);
return isMonitoringEnabled;
}

public abstract String getServiceDescription();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,26 @@

package com.cisco.oss.foundation.message;

import com.cisco.oss.foundation.configuration.ConfigurationFactory;
import com.cisco.oss.foundation.monitoring.CommunicationInfo;
import com.cisco.oss.foundation.monitoring.serverconnection.ServerConnectionDetails;
import org.apache.commons.configuration.Configuration;

/**
* Created by Yair Ogen on 16/06/2014.
*/
public abstract class AbstractMessageProducer implements MessageProducer {

protected String producerName;
protected String queueName = "";
private ServerConnectionDetails serverConnectionDetails = new ServerConnectionDetails(producerName,getProducerImpl(), "N/A", -1, -1);

public AbstractMessageProducer(String producerName){
this.producerName = producerName;
}

@Override
public void postSendMessage() {
if (isMonitoringEnabled()) {
CommunicationInfo.INSTANCE.transactionStarted(serverConnectionDetails,queueName);
}
}

@Override
public void preSendMessage() {
if (isMonitoringEnabled()) {
CommunicationInfo.INSTANCE.transactionFinished(serverConnectionDetails,queueName, false, "");
}
}

private boolean isMonitoringEnabled() {
Configuration configuration = ConfigurationFactory.getConfiguration();
Configuration subset = configuration.subset(producerName);
boolean isMonitoringEnabled = subset.getBoolean("queue.isMonitoringEnabled",false);
return isMonitoringEnabled;
}

public abstract String getProducerImpl();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;


@Component
class ArrayMessageDispatcher extends AbstractMessageDispatcher {

private static final Logger LOGGER = LoggerFactory.getLogger(ArrayMessageDispatcher.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,26 @@

package com.cisco.oss.foundation.message;

import com.cisco.oss.foundation.configuration.ConfigurationFactory;
import org.apache.commons.configuration.Configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;


@Component
public class ConfigurationMessageIdentifier implements MessageIdentifier {

public static final String MESSAGE_IDENTIFIER_PROPERTY = "messageHandling.messageIdentifierProperty";

private final String identifierProperty;


@Autowired
private Environment environment;

@Value("${"+MESSAGE_IDENTIFIER_PROPERTY+"}")
private String identifierProperty=null;

public ConfigurationMessageIdentifier() {
Configuration config = ConfigurationFactory.getConfiguration();
identifierProperty = config.getString(MESSAGE_IDENTIFIER_PROPERTY);
}

public String getIdentifier(Message message) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.cisco.oss.foundation.message;

import org.springframework.stereotype.Component;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
Expand All @@ -28,6 +30,7 @@
* @author yglass
*
*/
@Component
public class LockMessageDispatcher extends AbstractMessageDispatcher {

//private static final Logger LOGGER = LoggerFactory.getLogger(LockMessageDispatcher.class);
Expand Down
24 changes: 0 additions & 24 deletions queue-api/src/main/resources/configSchema.xml

This file was deleted.

38 changes: 3 additions & 35 deletions queue-rabbitmq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<groupId>com.cisco.oss.foundation.queue</groupId>
<artifactId>queue-rabbitmq</artifactId>
<name>queue-rabbitmq</name>
<version>1.5.3-2-SNAPSHOT</version>
<version>2.0.0-1-SNAPSHOT</version>
<description>This project is a rabbitmq implementation for the queue-api library.</description>
<url>https://github.com/foundation-runtime/communication/tree/master/queue-rabbitmq</url>
<issueManagement>
Expand All @@ -47,10 +47,7 @@
</developers>
<properties>
<foundation-common-base-version>1.0.1-5</foundation-common-base-version>
<rabbitmq-version>4.1.0</rabbitmq-version>
<logging-api-version>1.0.2-1</logging-api-version>
<logging-log4j-version>1.0.2-1</logging-log4j-version>
<configuration-lib-version>1.0.3-1</configuration-lib-version>
<rabbitmq-version>3.6.0</rabbitmq-version>
</properties>
<scm>
<connection>scm:git:[email protected]:foundation-runtime/communication.git</connection>
Expand Down Expand Up @@ -88,23 +85,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>queue-api</artifactId>
<version>1.1.1-0</version>
</dependency>
<dependency>
<groupId>com.cisco.oss.foundation</groupId>
<artifactId>configuration-lib</artifactId>
<version>${configuration-lib-version}</version>
</dependency>
<dependency>
<groupId>com.cisco.oss.foundation</groupId>
<artifactId>logging-api</artifactId>
<version>${logging-api-version}</version>
</dependency>
<dependency>
<groupId>org.hornetq</groupId>
<artifactId>hornetq-server</artifactId>
<version>2.4.4.Final</version>
<scope>test</scope>
<version>2.0.0-1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
Expand Down Expand Up @@ -150,18 +131,5 @@
<version>${logging-log4j-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.cisco.oss.foundation</groupId>
<artifactId>http-client-jetty</artifactId>
<version>0.0.0-8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.cisco.oss.foundation</groupId>
<artifactId>configuration-lib</artifactId>
<version>${configuration-lib-version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand All @@ -27,6 +28,7 @@
* Basic abstract handler that exposes the foundation message handler but also implements silently the RabbitMQ message handler
* Created by Yair Ogen on 24/04/2014.
*/
@Component
public abstract class AbstractRabbitMQConcurrentMessageHandler extends AbstractRabbitMQMessageHandler implements ConcurrentMessageHandler{

private static final Logger LOGGER = LoggerFactory.getLogger(AbstractRabbitMQConcurrentMessageHandler.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
import com.cisco.oss.foundation.flowcontext.FlowContextFactory;
import com.rabbitmq.client.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
* Basic abstract handler that exposes the foundation message handler but also implements silently the RabbitMQ message handler
* Created by Yair Ogen on 24/04/2014.
*/
@Component
public abstract class AbstractRabbitMQMessageHandler extends AbstractMessageHandler implements Consumer {

/**
Expand Down
Loading