public class Client
extends java.lang.Object
| Constructor and Description |
|---|
Client(java.lang.String url)
Construct an instance with the provided url and credentials.
|
Client(java.lang.String url,
java.lang.String username,
java.lang.String password)
Construct an instance with the provided url and credentials.
|
Client(java.lang.String url,
java.lang.String username,
java.lang.String password,
HttpClientBuilderConfigurator configurator)
Construct an instance with the provided url and credentials.
|
Client(java.net.URL url)
Construct an instance with the provided url and credentials.
|
Client(java.net.URL url,
java.lang.String username,
java.lang.String password)
Construct an instance with the provided url and credentials.
|
Client(java.net.URL url,
java.lang.String username,
java.lang.String password,
HttpClientBuilderConfigurator configurator)
Construct an instance with the provided url and credentials.
|
Client(java.net.URL url,
java.lang.String username,
java.lang.String password,
javax.net.ssl.SSLContext sslContext)
Construct an instance with the provided url and credentials.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
alivenessTest(java.lang.String vhost)
Performs a basic node aliveness check: declares a queue, publishes a message
that routes to it, consumes it, cleans up.
|
void |
bindExchange(java.lang.String vhost,
java.lang.String destination,
java.lang.String source,
java.lang.String routingKey)
Binds a destination exchange to a source one.
|
void |
bindExchange(java.lang.String vhost,
java.lang.String destination,
java.lang.String source,
java.lang.String routingKey,
java.util.Map<java.lang.String,java.lang.Object> args)
Binds a destination exchange to a source one.
|
void |
bindQueue(java.lang.String vhost,
java.lang.String queue,
java.lang.String exchange,
java.lang.String routingKey)
Binds a queue to an exchange.
|
void |
bindQueue(java.lang.String vhost,
java.lang.String queue,
java.lang.String exchange,
java.lang.String routingKey,
java.util.Map<java.lang.String,java.lang.Object> args)
Binds a queue to an exchange.
|
void |
clearPermissions(java.lang.String vhost,
java.lang.String username) |
void |
clearTopicPermissions(java.lang.String vhost,
java.lang.String username) |
void |
closeConnection(java.lang.String name)
Forcefully closes individual connection.
|
void |
closeConnection(java.lang.String name,
java.lang.String reason)
Forcefully closes individual connection with a user-provided message.
|
void |
createUser(java.lang.String username,
char[] password,
java.util.List<java.lang.String> tags) |
void |
createUserWithPasswordHash(java.lang.String username,
char[] passwordHash,
java.util.List<java.lang.String> tags) |
void |
createVhost(java.lang.String name) |
void |
createVhost(java.lang.String name,
boolean tracing)
Create a virtual host with name and tracing flag.
|
void |
createVhost(java.lang.String name,
boolean tracing,
java.lang.String description,
java.lang.String... tags)
Create a virtual host with name, tracing flag, and metadata.
|
void |
createVhost(java.lang.String name,
java.lang.String description,
java.lang.String... tags)
Create a virtual host with name and metadata.
|
void |
declareExchange(java.lang.String vhost,
java.lang.String name,
ExchangeInfo info) |
void |
declarePolicy(java.lang.String vhost,
java.lang.String name,
PolicyInfo info) |
void |
declareQueue(java.lang.String vhost,
java.lang.String name,
QueueInfo info) |
void |
declareShovel(java.lang.String vhost,
ShovelInfo info)
Declares a shovel.
|
void |
declareUpstream(java.lang.String vhost,
java.lang.String name,
UpstreamDetails details)
Declares an upstream
|
void |
declareUpstreamSet(java.lang.String vhost,
java.lang.String name,
java.util.List<UpstreamSetDetails> details)
Declares an upstream set.
|
void |
deleteExchange(java.lang.String vhost,
java.lang.String name) |
void |
deletePolicy(java.lang.String vhost,
java.lang.String name) |
void |
deleteQueue(java.lang.String vhost,
java.lang.String name) |
void |
deleteShovel(java.lang.String vhost,
java.lang.String shovelname)
Deletes the specified shovel from specified virtual host.
|
void |
deleteUpstream(java.lang.String vhost,
java.lang.String name)
Deletes an upstream
|
void |
deleteUpstreamSet(java.lang.String vhost,
java.lang.String name)
Deletes an upstream set
|
void |
deleteUser(java.lang.String username) |
void |
deleteVhost(java.lang.String name) |
InboundMessage |
get(java.lang.String vhost,
java.lang.String queue)
Get one message from a queue and requeue it.
|
java.util.List<InboundMessage> |
get(java.lang.String vhost,
java.lang.String queue,
int count,
GetAckMode ackMode,
GetEncoding encoding)
Get messages from a queue, with no limit for message payload truncation.
|
java.util.List<InboundMessage> |
get(java.lang.String vhost,
java.lang.String queue,
int count,
GetAckMode ackMode,
GetEncoding encoding,
int truncate)
Get messages from a queue.
|
java.util.List<BindingInfo> |
getBindings() |
java.util.List<BindingInfo> |
getBindings(java.lang.String vhost) |
java.util.List<BindingInfo> |
getBindingsBySource(java.lang.String vhost,
java.lang.String exchange)
Returns a list of bindings where provided exchange is the source (other things are
bound to it).
|
ChannelInfo |
getChannel(java.lang.String name)
Retrieves state and metrics information for individual channel.
|
java.util.List<ChannelInfo> |
getChannels()
Retrieves state and metrics information for all channels across the cluster.
|
java.util.List<ChannelInfo> |
getChannels(java.lang.String connectionName)
Retrieves state and metrics information for all channels on individual connection.
|
ClusterId |
getClusterName() |
ConnectionInfo |
getConnection(java.lang.String name)
Retrieves state and metrics information for individual client connection.
|
java.util.List<ConnectionInfo> |
getConnections()
Retrieves state and metrics information for all client connections across the cluster.
|
Definitions |
getDefinitions() |
ExchangeInfo |
getExchange(java.lang.String vhost,
java.lang.String name) |
java.util.List<BindingInfo> |
getExchangeBindingsBetween(java.lang.String vhost,
java.lang.String source,
java.lang.String destination) |
java.util.List<BindingInfo> |
getExchangeBindingsByDestination(java.lang.String vhost,
java.lang.String exchange)
Returns a list of bindings where provided exchange is the destination (it is
bound to another exchange).
|
java.util.List<ExchangeInfo> |
getExchanges() |
java.util.List<ExchangeInfo> |
getExchanges(java.lang.String vhost) |
java.util.List<java.util.Map> |
getExtensions() |
NodeInfo |
getNode(java.lang.String name)
Retrieves state and metrics information for individual node.
|
java.util.List<NodeInfo> |
getNodes()
Retrieves state and metrics information for all nodes in the cluster.
|
OverviewResponse |
getOverview() |
java.util.List<UserPermissions> |
getPermissions() |
UserPermissions |
getPermissions(java.lang.String vhost,
java.lang.String username) |
java.util.List<UserPermissions> |
getPermissionsIn(java.lang.String vhost) |
java.util.List<UserPermissions> |
getPermissionsOf(java.lang.String username) |
java.util.List<PolicyInfo> |
getPolicies() |
java.util.List<PolicyInfo> |
getPolicies(java.lang.String vhost) |
QueueInfo |
getQueue(java.lang.String vhost,
java.lang.String name) |
java.util.List<BindingInfo> |
getQueueBindings(java.lang.String vhost,
java.lang.String queue)
Returns a list of bindings where provided queue is the destination.
|
java.util.List<BindingInfo> |
getQueueBindingsBetween(java.lang.String vhost,
java.lang.String exchange,
java.lang.String queue) |
java.util.List<QueueInfo> |
getQueues() |
java.util.List<QueueInfo> |
getQueues(java.lang.String vhost) |
java.util.List<ShovelInfo> |
getShovels()
Returns virtual host shovels.
|
java.util.List<ShovelInfo> |
getShovels(java.lang.String vhost)
Returns virtual host shovels.
|
java.util.List<ShovelStatus> |
getShovelsStatus()
Returns virtual host shovels.
|
java.util.List<ShovelStatus> |
getShovelsStatus(java.lang.String vhost)
Returns virtual host shovels.
|
java.util.List<TopicPermissions> |
getTopicPermissions() |
java.util.List<TopicPermissions> |
getTopicPermissions(java.lang.String vhost,
java.lang.String username) |
java.util.List<TopicPermissions> |
getTopicPermissionsIn(java.lang.String vhost) |
java.util.List<TopicPermissions> |
getTopicPermissionsOf(java.lang.String username) |
java.util.List<UpstreamInfo> |
getUpstreams()
Returns a list of upstreams for "/" virtual host
|
java.util.List<UpstreamInfo> |
getUpstreams(java.lang.String vhost)
Returns a list of upstreams
|
java.util.List<UpstreamSetInfo> |
getUpstreamSets()
Returns a list of upstream sets for "/" virtual host
|
java.util.List<UpstreamSetInfo> |
getUpstreamSets(java.lang.String vhost)
Returns a ist of upstream sets
|
UserInfo |
getUser(java.lang.String username) |
java.util.List<UserInfo> |
getUsers() |
VhostInfo |
getVhost(java.lang.String name) |
java.util.List<VhostInfo> |
getVhosts() |
boolean |
publish(java.lang.String vhost,
java.lang.String exchange,
java.lang.String routingKey,
OutboundMessage outboundMessage)
Publishes a message to an exchange.
|
void |
purgeQueue(java.lang.String vhost,
java.lang.String name) |
void |
setClusterName(java.lang.String name) |
void |
unbindExchange(java.lang.String vhost,
java.lang.String destination,
java.lang.String source,
java.lang.String routingKey)
Unbinds a destination exchange from a source one.
|
void |
unbindQueue(java.lang.String vhost,
java.lang.String queue,
java.lang.String exchange,
java.lang.String routingKey)
Unbinds a queue from an exchange.
|
void |
updatePermissions(java.lang.String vhost,
java.lang.String username,
UserPermissions permissions) |
void |
updateTopicPermissions(java.lang.String vhost,
java.lang.String username,
TopicPermissions permissions) |
void |
updateUser(java.lang.String username,
char[] password,
java.util.List<java.lang.String> tags) |
CurrentUserDetails |
whoAmI() |
public Client(java.lang.String url,
java.lang.String username,
java.lang.String password)
throws java.net.MalformedURLException,
java.net.URISyntaxException
url - the url e.g. "http://localhost:15672/api/".username - the username.password - the passwordjava.net.MalformedURLException - for a badly formed URL.java.net.URISyntaxException - for a badly formed URL.public Client(java.lang.String url,
java.lang.String username,
java.lang.String password,
HttpClientBuilderConfigurator configurator)
throws java.net.MalformedURLException,
java.net.URISyntaxException
url - the url e.g. "http://localhost:15672/api/".username - the username.password - the passwordconfigurator - HttpClientBuilderConfigurator to usejava.net.MalformedURLException - for a badly formed URL.java.net.URISyntaxException - for a badly formed URL.public Client(java.net.URL url,
java.lang.String username,
java.lang.String password)
throws java.net.MalformedURLException,
java.net.URISyntaxException
url - the url e.g. "http://localhost:15672/api/".username - the username.password - the passwordjava.net.MalformedURLException - for a badly formed URL.java.net.URISyntaxException - for a badly formed URL.public Client(java.net.URL url,
java.lang.String username,
java.lang.String password,
HttpClientBuilderConfigurator configurator)
throws java.net.MalformedURLException,
java.net.URISyntaxException
url - the url e.g. "http://localhost:15672/api/".username - the username.password - the passwordconfigurator - HttpClientBuilderConfigurator to usejava.net.MalformedURLException - for a badly formed URL.java.net.URISyntaxException - for a badly formed URL.public Client(java.net.URL url,
java.lang.String username,
java.lang.String password,
javax.net.ssl.SSLContext sslContext)
throws java.net.MalformedURLException,
java.net.URISyntaxException
url - the url e.g. "http://localhost:15672/api/".username - the username.password - the passwordsslContext - ssl context for http clientjava.net.MalformedURLException - for a badly formed URL.java.net.URISyntaxException - for a badly formed URL.public Client(java.lang.String url)
throws java.net.MalformedURLException,
java.net.URISyntaxException
url - the url e.g. "https://guest:guest@localhost:15672/api/".java.net.MalformedURLException - for a badly formed URL.java.net.URISyntaxException - for a badly formed URL.public Client(java.net.URL url)
throws java.net.MalformedURLException,
java.net.URISyntaxException
url - the url e.g. "https://guest:guest@localhost:15672/api/".java.net.MalformedURLException - for a badly formed URL.java.net.URISyntaxException - for a badly formed URL.public OverviewResponse getOverview()
public boolean alivenessTest(java.lang.String vhost)
vhost - vhost to use to perform aliveness check inpublic CurrentUserDetails whoAmI()
public java.util.List<NodeInfo> getNodes()
public NodeInfo getNode(java.lang.String name)
name - node namepublic java.util.List<ConnectionInfo> getConnections()
public ConnectionInfo getConnection(java.lang.String name)
name - connection namepublic void closeConnection(java.lang.String name)
name - connection namepublic void closeConnection(java.lang.String name,
java.lang.String reason)
name - connection namereason - the reason of closingpublic java.util.List<ChannelInfo> getChannels()
public java.util.List<ChannelInfo> getChannels(java.lang.String connectionName)
connectionName - the connection name to retrieve channelspublic ChannelInfo getChannel(java.lang.String name)
name - channel namepublic java.util.List<VhostInfo> getVhosts()
public VhostInfo getVhost(java.lang.String name)
public void createVhost(java.lang.String name,
boolean tracing,
java.lang.String description,
java.lang.String... tags)
name - name of the virtual hosttracing - whether tracing is enabled or notdescription - virtual host description (requires RabbitMQ 3.8 or more)tags - virtual host tags (requires RabbitMQ 3.8 or more)public void createVhost(java.lang.String name,
java.lang.String description,
java.lang.String... tags)
name - name of the virtual hostdescription - virtual host description (requires RabbitMQ 3.8 or more)tags - virtual host tags (requires RabbitMQ 3.8 or more)public void createVhost(java.lang.String name,
boolean tracing)
name - name of the virtual hosttracing - whether tracing is enabled or notpublic void createVhost(java.lang.String name)
public void deleteVhost(java.lang.String name)
public java.util.List<UserPermissions> getPermissionsIn(java.lang.String vhost)
public java.util.List<UserPermissions> getPermissionsOf(java.lang.String username)
public java.util.List<UserPermissions> getPermissions()
public UserPermissions getPermissions(java.lang.String vhost, java.lang.String username)
public java.util.List<TopicPermissions> getTopicPermissionsIn(java.lang.String vhost)
public java.util.List<TopicPermissions> getTopicPermissionsOf(java.lang.String username)
public java.util.List<TopicPermissions> getTopicPermissions()
public java.util.List<TopicPermissions> getTopicPermissions(java.lang.String vhost, java.lang.String username)
public java.util.List<ExchangeInfo> getExchanges()
public java.util.List<ExchangeInfo> getExchanges(java.lang.String vhost)
public ExchangeInfo getExchange(java.lang.String vhost, java.lang.String name)
public void declareExchange(java.lang.String vhost,
java.lang.String name,
ExchangeInfo info)
public void deleteExchange(java.lang.String vhost,
java.lang.String name)
public boolean publish(java.lang.String vhost,
java.lang.String exchange,
java.lang.String routingKey,
OutboundMessage outboundMessage)
DO NOT USE THIS METHOD IN PRODUCTION. The HTTP API has to create a new TCP connection for each message published, which is highly suboptimal.
Use this method for test or development code only. In production, use AMQP 0-9-1 or any other messaging protocol that uses a long-lived connection.
vhost - the virtual host to useexchange - the target exchangeroutingKey - the routing key to useoutboundMessage - the message to publishpublic java.util.List<QueueInfo> getQueues()
public java.util.List<QueueInfo> getQueues(java.lang.String vhost)
public QueueInfo getQueue(java.lang.String vhost, java.lang.String name)
public void declarePolicy(java.lang.String vhost,
java.lang.String name,
PolicyInfo info)
public void declareQueue(java.lang.String vhost,
java.lang.String name,
QueueInfo info)
public void purgeQueue(java.lang.String vhost,
java.lang.String name)
public void deleteQueue(java.lang.String vhost,
java.lang.String name)
public java.util.List<InboundMessage> get(java.lang.String vhost, java.lang.String queue, int count, GetAckMode ackMode, GetEncoding encoding, int truncate)
vhost - the virtual host the target queue is inqueue - the queue to consume fromcount - the maximum number of messages to getackMode - determines whether the messages will be removed from the queueencoding - the expected encoding of the message payloadtruncate - to truncate the message payload if it is larger than the size given (in bytes), -1 means no truncationGetAckMode,
GetEncodingpublic java.util.List<InboundMessage> get(java.lang.String vhost, java.lang.String queue, int count, GetAckMode ackMode, GetEncoding encoding)
vhost - the virtual host the target queue is inqueue - the queue to consume fromcount - the maximum number of messages to getackMode - determines whether the messages will be removed from the queueencoding - the expected encoding of the message payloadGetAckMode,
GetEncodingpublic InboundMessage get(java.lang.String vhost, java.lang.String queue)
vhost - the virtual host the target queue is inqueue - the queue to consume fromGetAckMode,
GetEncodingpublic void deletePolicy(java.lang.String vhost,
java.lang.String name)
public java.util.List<UserInfo> getUsers()
public UserInfo getUser(java.lang.String username)
public void createUser(java.lang.String username,
char[] password,
java.util.List<java.lang.String> tags)
public void createUserWithPasswordHash(java.lang.String username,
char[] passwordHash,
java.util.List<java.lang.String> tags)
public void updateUser(java.lang.String username,
char[] password,
java.util.List<java.lang.String> tags)
public void deleteUser(java.lang.String username)
public void updatePermissions(java.lang.String vhost,
java.lang.String username,
UserPermissions permissions)
public void clearPermissions(java.lang.String vhost,
java.lang.String username)
public void updateTopicPermissions(java.lang.String vhost,
java.lang.String username,
TopicPermissions permissions)
public void clearTopicPermissions(java.lang.String vhost,
java.lang.String username)
public java.util.List<PolicyInfo> getPolicies()
public java.util.List<PolicyInfo> getPolicies(java.lang.String vhost)
public java.util.List<BindingInfo> getBindings()
public java.util.List<BindingInfo> getBindings(java.lang.String vhost)
public java.util.List<BindingInfo> getBindingsBySource(java.lang.String vhost, java.lang.String exchange)
vhost - vhost of the exchangeexchange - source exchange namepublic java.util.List<BindingInfo> getExchangeBindingsByDestination(java.lang.String vhost, java.lang.String exchange)
vhost - vhost of the exchangeexchange - destination exchange namepublic java.util.List<BindingInfo> getQueueBindings(java.lang.String vhost, java.lang.String queue)
vhost - vhost of the exchangequeue - destination queue namepublic java.util.List<BindingInfo> getQueueBindingsBetween(java.lang.String vhost, java.lang.String exchange, java.lang.String queue)
public java.util.List<BindingInfo> getExchangeBindingsBetween(java.lang.String vhost, java.lang.String source, java.lang.String destination)
public void bindQueue(java.lang.String vhost,
java.lang.String queue,
java.lang.String exchange,
java.lang.String routingKey)
vhost - virtual host the queue and exchange are inqueue - the queue nameexchange - the exchange nameroutingKey - the routing key to usepublic void bindQueue(java.lang.String vhost,
java.lang.String queue,
java.lang.String exchange,
java.lang.String routingKey,
java.util.Map<java.lang.String,java.lang.Object> args)
vhost - virtual host the queue and exchange are inqueue - the queue nameexchange - the exchange nameroutingKey - the routing key to useargs - additional map of arguments (used by some exchange types)public void unbindQueue(java.lang.String vhost,
java.lang.String queue,
java.lang.String exchange,
java.lang.String routingKey)
vhost - virtual host the queue and exchange are inqueue - the queue nameexchange - the exchange nameroutingKey - the routing key used when bindingpublic void bindExchange(java.lang.String vhost,
java.lang.String destination,
java.lang.String source,
java.lang.String routingKey)
vhost - virtual host the exchanges are indestination - the destination exchange namesource - the source exchange nameroutingKey - the routing key to usepublic void bindExchange(java.lang.String vhost,
java.lang.String destination,
java.lang.String source,
java.lang.String routingKey,
java.util.Map<java.lang.String,java.lang.Object> args)
vhost - virtual host the exchanges are indestination - the destination exchange namesource - the source exchange nameroutingKey - the routing key to useargs - additional map of arguments (used by some exchange types)public void unbindExchange(java.lang.String vhost,
java.lang.String destination,
java.lang.String source,
java.lang.String routingKey)
vhost - virtual host the exchanges are indestination - the destination exchange namesource - the source exchange nameroutingKey - the routing key used when bindingpublic ClusterId getClusterName()
public void setClusterName(java.lang.String name)
public java.util.List<java.util.Map> getExtensions()
public Definitions getDefinitions()
public void declareShovel(java.lang.String vhost,
ShovelInfo info)
vhost - virtual host where to declare the shovelinfo - Shovel info.public java.util.List<ShovelInfo> getShovels()
public java.util.List<ShovelInfo> getShovels(java.lang.String vhost)
vhost - Virtual host from where search shovels.public java.util.List<ShovelStatus> getShovelsStatus()
public java.util.List<ShovelStatus> getShovelsStatus(java.lang.String vhost)
vhost - Virtual host from where search shovels.public void deleteShovel(java.lang.String vhost,
java.lang.String shovelname)
vhost - virtual host from where to delete the shovelshovelname - Shovel to be deleted.public void declareUpstream(java.lang.String vhost,
java.lang.String name,
UpstreamDetails details)
vhost - virtual host for which to declare the upstreamname - name of the upstream to declaredetails - upstream argumentspublic void deleteUpstream(java.lang.String vhost,
java.lang.String name)
vhost - virtual host for which to delete the upstreamname - name of the upstream to deletepublic java.util.List<UpstreamInfo> getUpstreams()
public java.util.List<UpstreamInfo> getUpstreams(java.lang.String vhost)
vhost - virtual host the upstreams are in.public void declareUpstreamSet(java.lang.String vhost,
java.lang.String name,
java.util.List<UpstreamSetDetails> details)
vhost - virtual host for which to declare the upstream setname - name of the upstream set to declaredetails - upstream set argumentspublic void deleteUpstreamSet(java.lang.String vhost,
java.lang.String name)
vhost - virtual host for which to delete the upstream setname - name of the upstream set to deletepublic java.util.List<UpstreamSetInfo> getUpstreamSets()
public java.util.List<UpstreamSetInfo> getUpstreamSets(java.lang.String vhost)
vhost - Virtual host from where to get upstreams.