Dropship Agent Library

Library to aid in the development of Dropship friendly agents

License

License

GroupId

GroupId

com.zulily.dropship
ArtifactId

ArtifactId

dropship-agent
Last Version

Last Version

0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Dropship Agent Library
Library to aid in the development of Dropship friendly agents
Project URL

Project URL

https://github.com/zulily/dropship-agent
Project Organization

Project Organization

zulily, Inc.
Source Code Management

Source Code Management

http://github.com/zulily/dropship-agent

Download dropship-agent

How to add to project

<!-- https://jarcasting.com/artifacts/com.zulily.dropship/dropship-agent/ -->
<dependency>
    <groupId>com.zulily.dropship</groupId>
    <artifactId>dropship-agent</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.zulily.dropship/dropship-agent/
implementation 'com.zulily.dropship:dropship-agent:0.1'
// https://jarcasting.com/artifacts/com.zulily.dropship/dropship-agent/
implementation ("com.zulily.dropship:dropship-agent:0.1")
'com.zulily.dropship:dropship-agent:jar:0.1'
<dependency org="com.zulily.dropship" name="dropship-agent" rev="0.1">
  <artifact name="dropship-agent" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.zulily.dropship', module='dropship-agent', version='0.1')
)
libraryDependencies += "com.zulily.dropship" % "dropship-agent" % "0.1"
[com.zulily.dropship/dropship-agent "0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.javassist : javassist jar 3.18.1-GA

test (2)

Group / Artifact Type Version
junit : junit jar 4.11
org.easytesting : fest-assert jar 1.4

Project Modules

There are no modules declared in this project.

dropship-agent

Library for aiding in the development of "agents" or "plugins" for dropship.

What For?

Implement a dropship agent if you wish to have code that runs before and after your target application. For example, you may wish to start up some threads that send JMX metrics to statsd.

How?

BaseAgent provides methods to configure basic interaction with the Dropship lifecycle. Instances of subclasses of BaseAgent are wired in to the preRun, onError and onExit methods of Dropship.

To build a Dropship agent,

  1. Extend BaseAgent
    • Implement onStart(Properties, String, Class, Method, Object[]) - which will be invoked just before Dropship hands control over to the target
    • Implement onError(Throwable) - which will be invoked in the event of an exception from the target (or an unhandled exception in any threads).
    • Implement onExit(), which will be invoked as Dropship is shutting down
  2. Create a public static void premain(String agentArgument, Instrumentation instrumentation) method
    • In it, instantiate your agent
    • Pass that instance to premain(String, Instrumentation, BaseAgent)
  3. Package your agent as a jar file. You will probably want to create a "shaded" jar
  4. Add a Premain-Class entry to the MANIFEST.MF in your jar file
  5. Use your agent from the command line: java -javaagent:youragent.jar -jar dropship.jar ...

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
com.zulily.dropship

zulily

Versions

Version
0.1