-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5f7ec2e
Showing
20 changed files
with
1,600 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Jmeter-GCP-PubSub-Sampler | ||
|
||
## Introduction | ||
|
||
This plugin adds feature to connect to a topic to publish/subscribe messages in GCP | ||
|
||
## Required Components | ||
|
||
1. Jmeter | ||
2. GCP Pubsub configs | ||
|
||
|
||
## Jar Dependencies Required | ||
|
||
* google-cloud-pubsub-1.88.0.jar or above | ||
* gson-2.2.4.jar | ||
|
||
## Jmeter Target | ||
|
||
* Jmeter version 5.1.1 or above | ||
* Java 8 or above | ||
|
||
## Installation Instructions | ||
|
||
* Download the source code from the Gitlab. | ||
* Just do a mvn clean install (Git bash is required) | ||
* Jar will be generated under the target directory (jmeter-pubsub-sampler-1.0.jar) | ||
* Copy the Jar to \<Jmeter Installed Directory\>/lib/ext/ | ||
|
||
## How to use it | ||
Add required config element (Publisher config/ Subscriber config) | ||
|
||
* Provide the required credentials information in the Publisher config/ Subscriber config for the project | ||
* To publish message, Add Publisher sampler to TG and then pass the message to publish | ||
* To receive message, Add Subscriber sampler to TG to read the mesasges | ||
|
||
# Publisher Info | ||
Apart from config element, Publisher sampler has Gzip compression feature | ||
* The Flag in the sampler will allow the mechanism to publish the message with/without Gzip compression | ||
* On successfull publish of each message, GCP returns a unique Id which will be returned in response header. | ||
|
||
# Subscriber Info | ||
The subscriber works perfectly. The current mechanism of Subscriber is | ||
* The config elements creats a local queue to store the messages received from the GCP. | ||
* Currently the Queue size is hardcoded to 100K | ||
* The Subscriber sampler is bound to read it form the queue, which is already subscribed by the Message receiver(which is a separate client library's thread) | ||
* The subscriber sampler is reading and removing the message from the queue. In future, will change the ack to be done by the sampler. | ||
* When the susbcriber sampler is triggered and If there is no messages in the queue, It will wait until a new message arrive to process it. | ||
* each message retrieved from the subscriber will have the message ID and publish time info along with the message. | ||
* The message ID and publish time info will be returned in response headers and message on response body | ||
* The subscriber sampler supports De-Compression, If the message is in gzip compressed format. | ||
|
||
|
||
## References | ||
|
||
Below are the references which guided to build this plugin. | ||
|
||
* https://cloud.google.com/pubsub/docs/quickstart-client-libraries | ||
* https://cloud.google.com/pubsub/docs/publisher | ||
* https://cloud.google.com/pubsub/docs/pull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.di.jmeter.sampler</groupId> | ||
<artifactId>jmeter-pubsub-sampler</artifactId> | ||
<version>1.0</version> | ||
<properties> | ||
<di-jmeter-version>5.1.1</di-jmeter-version> | ||
<jmeter.lib.scope>provided</jmeter.lib.scope> | ||
<google.cloud.pubsub.version>1.86.0</google.cloud.pubsub.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.jmeter</groupId> | ||
<artifactId>ApacheJMeter_java</artifactId> | ||
<version>${di-jmeter-version}</version> | ||
<scope>${jmeter.lib.scope}</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>28.1-android</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.cloud</groupId> | ||
<artifactId>google-cloud-pubsub</artifactId> | ||
<version>${google.cloud.pubsub.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy</id> | ||
<phase>prepare-package</phase> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
<configuration> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>com.google.cloud</groupId> | ||
<artifactId>google-cloud-pubsub</artifactId> | ||
<version>${google.cloud.pubsub.version}</version> | ||
<outputDirectory>${project.build.directory}/lib</outputDirectory> | ||
</artifactItem> | ||
</artifactItems> | ||
<resources> | ||
<resource> | ||
<directory>${basedir}/src/main/resources/com/di/jmeter/pubsub/config/*.properties</directory> | ||
<filtering>false</filtering> | ||
</resource> | ||
<resource> | ||
<directory>${basedir}/src/main/resources/com/di/jmeter/pubsub/sampler/*.properties</directory> | ||
<filtering>false</filtering> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.4</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.1.0</version> | ||
<configuration> | ||
<shadedArtifactAttached>false</shadedArtifactAttached> | ||
<createDependencyReducedPom>false</createDependencyReducedPom> | ||
<artifactSet> | ||
<includes> | ||
<include>com.google.cloud:*</include> | ||
<include>com.google.auth:*</include> | ||
<include>com.google.api:*</include> | ||
<include>com.google.api.grpc:*</include> | ||
<include>io.opencensus:*</include> | ||
<include>com.google.protobuf:*</include> | ||
<include>com.google.guava:*</include> | ||
<include>org.checkerframework:checker-compat-qual</include> | ||
<include>com.google.errorprone:error_prone_annotations</include> | ||
<include>com.google.j2objc:j2objc-annotations</include> | ||
<include>org.codehaus.mojo:animal-sniffer-annotations</include> | ||
<include>io.grpc:*</include> | ||
<include>org.threeten:threetenbp</include> | ||
<include>com.google.http-client:*</include> | ||
<include>com.google.android:annotations</include> | ||
</includes> | ||
</artifactSet> | ||
<filters> | ||
<filter> | ||
<artifact>*:*</artifact> | ||
</filter> | ||
</filters> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>8</source> | ||
<target>8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.