Skip to content

Commit

Permalink
Upgrade AMQP-Client compatibility to 3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
John Kelly committed Apr 7, 2015
1 parent 7d62133 commit 5043b6a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<dependency org="commons-net" name="commons-net" rev="1.4.1" conf="build->default"/>
<dependency org="org.apache.jmeter" name="jorphan" rev="2.6" conf="build->default"/>
<dependency org="avalon-logkit" name="avalon-logkit" rev="2.0" conf="build->default"/>
<dependency org="com.rabbitmq" name="amqp-client" rev="3.3.4" conf="build->default"/>
<dependency org="com.rabbitmq" name="amqp-client" rev="3.5.1" conf="build->default"/>
<dependency org="org.apache.jmeter" name="ApacheJMeter_core" rev="2.11" conf="build->default"/>
</dependencies>
</ivy-module>
21 changes: 10 additions & 11 deletions src/main/com/zeroclue/jmeter/protocol/amqp/AMQPPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public SampleResult sample(Entry e) {
result.sampleStart(); // Start timing
try {
AMQP.BasicProperties messageProperties = getProperties();
messageProperties.setHeaders(prepareHeaders());
byte[] messageBytes = getMessageBytes();

for (int idx = 0; idx < loop; idx++) {
Expand Down Expand Up @@ -221,20 +220,20 @@ protected void setChannel(Channel channel) {
this.channel = channel;
}

@Override
protected AMQP.BasicProperties getProperties() {
AMQP.BasicProperties parentProps = super.getProperties();
AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder();

int deliveryMode = getPersistent() ? 2 : 1;

AMQP.BasicProperties publishProperties =
new AMQP.BasicProperties(parentProps.getContentType(), parentProps.getContentEncoding(),
parentProps.getHeaders(), deliveryMode, parentProps.getPriority(),
getCorrelationId(), getReplyToQueue(), parentProps.getExpiration(),
parentProps.getMessageId(), parentProps.getTimestamp(), getMessageType(),
parentProps.getUserId(), parentProps.getAppId(), parentProps.getClusterId());

return publishProperties;
return builder
.contentType("text/plain")
.deliveryMode(deliveryMode)
.priority(0)
.correlationId(getCorrelationId())
.replyTo(getReplyToQueue())
.type(getMessageType())
.headers(prepareHeaders())
.build();
}

protected boolean initChannel() throws IOException, NoSuchAlgorithmException, KeyManagementException {
Expand Down
6 changes: 0 additions & 6 deletions src/main/com/zeroclue/jmeter/protocol/amqp/AMQPSampler.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ private Map<String, Object> getQueueArguments() {
protected abstract Channel getChannel();
protected abstract void setChannel(Channel channel);

// TODO: make this configurable
protected BasicProperties getProperties() {
AMQP.BasicProperties properties = MessageProperties.PERSISTENT_TEXT_PLAIN;
return properties;
}

/**
* @return a string for the sampleResult Title
*/
Expand Down

0 comments on commit 5043b6a

Please sign in to comment.