This closes #1915
This commit is contained in:
commit
005e9d67d0
|
@ -75,7 +75,6 @@ public abstract class ActionAbstract implements Action {
|
||||||
} else {
|
} else {
|
||||||
brokerEtc = getBrokerInstance() + "/etc";
|
brokerEtc = getBrokerInstance() + "/etc";
|
||||||
}
|
}
|
||||||
System.setProperty("artemis.instance.etc", brokerEtc);
|
|
||||||
}
|
}
|
||||||
return brokerEtc;
|
return brokerEtc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ public class Role implements Serializable {
|
||||||
this(name, send, consume, createDurableQueue, deleteDurableQueue, createNonDurableQueue, deleteNonDurableQueue, manage, consume);
|
this(name, send, consume, createDurableQueue, deleteDurableQueue, createNonDurableQueue, deleteNonDurableQueue, manage, consume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public Role(final String name,
|
public Role(final String name,
|
||||||
final boolean send,
|
final boolean send,
|
||||||
final boolean consume,
|
final boolean consume,
|
||||||
|
@ -156,6 +157,14 @@ public class Role implements Serializable {
|
||||||
return deleteNonDurableQueue;
|
return deleteNonDurableQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isManage() {
|
||||||
|
return manage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBrowse() {
|
||||||
|
return browse;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer stringReturn = new StringBuffer("Role {name=" + name + "; allows=[");
|
StringBuffer stringReturn = new StringBuffer("Role {name=" + name + "; allows=[");
|
||||||
|
@ -260,12 +269,4 @@ public class Role implements Serializable {
|
||||||
result = 31 * result + (browse ? 1 : 0);
|
result = 31 * result + (browse ? 1 : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isManage() {
|
|
||||||
return manage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBrowse() {
|
|
||||||
return browse;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,13 +30,16 @@ export TEST_TARGET="./target"
|
||||||
|
|
||||||
cd $ARTEMIS_HOME/examples/features/standard/
|
cd $ARTEMIS_HOME/examples/features/standard/
|
||||||
|
|
||||||
cd bridge; mvn verify; cd ..
|
cd auto-closeable; mvn verify; cd ..
|
||||||
cd bridge; mvn verify; cd ..
|
|
||||||
cd browser; mvn verify; cd ..
|
|
||||||
cd broker-plugin; mvn verify; cd ..
|
cd broker-plugin; mvn verify; cd ..
|
||||||
|
cd browser; mvn verify; cd ..
|
||||||
cd cdi; mvn verify; cd ..
|
cd cdi; mvn verify; cd ..
|
||||||
cd client-kickoff; mvn verify; cd ..
|
cd client-kickoff; mvn verify; cd ..
|
||||||
|
cd completion-listener; mvn verify; cd ..
|
||||||
cd consumer-rate-limit; mvn verify; cd ..
|
cd consumer-rate-limit; mvn verify; cd ..
|
||||||
|
cd context; mvn verify; cd ..
|
||||||
|
cd core-bridge; mvn verify; cd ..
|
||||||
|
cd database; mvn verify; cd ..
|
||||||
cd dead-letter; mvn verify; cd ..
|
cd dead-letter; mvn verify; cd ..
|
||||||
cd delayed-redelivery; mvn verify; cd ..
|
cd delayed-redelivery; mvn verify; cd ..
|
||||||
cd divert; mvn verify; cd ..
|
cd divert; mvn verify; cd ..
|
||||||
|
@ -45,16 +48,14 @@ cd embedded; mvn verify; cd ..
|
||||||
cd embedded-simple; mvn verify; cd ..
|
cd embedded-simple; mvn verify; cd ..
|
||||||
cd expiry; mvn verify; cd ..
|
cd expiry; mvn verify; cd ..
|
||||||
cd http-transport; mvn verify; cd ..
|
cd http-transport; mvn verify; cd ..
|
||||||
cd interceptor; mvn verify; cd ..
|
|
||||||
cd interceptor-client; mvn verify; cd ..
|
|
||||||
cd interceptor-client-mqtt; mvn verify; cd ..
|
|
||||||
cd jms-auto-closeable; mvn verify; cd ..
|
|
||||||
cd instantiate-connection-factory; mvn verify; cd ..
|
cd instantiate-connection-factory; mvn verify; cd ..
|
||||||
|
cd interceptor; mvn verify; cd ..
|
||||||
|
cd interceptor-amqp; mvn verify; cd ..
|
||||||
|
cd interceptor-client; mvn verify; cd ..
|
||||||
|
cd interceptor-mqtt; mvn verify; cd ..
|
||||||
cd jms-bridge; mvn verify; cd ..
|
cd jms-bridge; mvn verify; cd ..
|
||||||
cd jms-completion-listener; mvn verify; cd ..
|
|
||||||
cd jms-context; mvn verify; cd ..
|
|
||||||
cd jms-shared-consumer; mvn verify; cd ..
|
|
||||||
cd jmx; mvn verify; cd ..
|
cd jmx; mvn verify; cd ..
|
||||||
|
cd jmx-ssl; mvn verify; cd ..
|
||||||
|
|
||||||
# too big for most CI machines
|
# too big for most CI machines
|
||||||
#cd large-message; mvn verify; cd ..
|
#cd large-message; mvn verify; cd ..
|
||||||
|
@ -80,15 +81,18 @@ cd scheduled-message; mvn verify; cd ..
|
||||||
cd security; mvn verify; cd ..
|
cd security; mvn verify; cd ..
|
||||||
cd security-ldap; mvn verify; cd ..
|
cd security-ldap; mvn verify; cd ..
|
||||||
cd send-acknowledgements; mvn verify; cd ..
|
cd send-acknowledgements; mvn verify; cd ..
|
||||||
|
cd shared-consumer; mvn verify; cd ..
|
||||||
|
cd slow-consumer; mvn verify; cd ..
|
||||||
cd spring-integration; mvn verify; cd ..
|
cd spring-integration; mvn verify; cd ..
|
||||||
cd ssl-enabled; mvn verify; cd ..
|
cd ssl-enabled; mvn verify; cd ..
|
||||||
|
cd ssl-enabled-crl-mqtt; mvn verify; cd ..
|
||||||
cd ssl-enabled-dual-authentication; mvn verify; cd ..
|
cd ssl-enabled-dual-authentication; mvn verify; cd ..
|
||||||
cd static-selector; mvn verify; cd ..
|
cd static-selector; mvn verify; cd ..
|
||||||
cd temp-queue; mvn verify; cd ..
|
cd temp-queue; mvn verify; cd ..
|
||||||
cd topic; mvn verify; cd ..
|
cd topic; mvn verify; cd ..
|
||||||
cd topic-hierarchies; mvn verify; cd ..
|
cd topic-hierarchies; mvn verify; cd ..
|
||||||
cd topic-selector-example1; mvn verify; cd ..
|
cd topic-selector1; mvn verify; cd ..
|
||||||
cd topic-selector-example2; mvn verify; cd ..
|
cd topic-selector2; mvn verify; cd ..
|
||||||
cd transactional; mvn verify; cd ..
|
cd transactional; mvn verify; cd ..
|
||||||
cd xa-heuristic; mvn verify; cd ..
|
cd xa-heuristic; mvn verify; cd ..
|
||||||
cd xa-receive; mvn verify; cd ..
|
cd xa-receive; mvn verify; cd ..
|
||||||
|
@ -134,5 +138,37 @@ cd scale-down; mvn verify; cd ..
|
||||||
cd transaction-failover; mvn verify; cd ..
|
cd transaction-failover; mvn verify; cd ..
|
||||||
|
|
||||||
|
|
||||||
|
cd $ARTEMIS_HOME/examples/protocols/amqp/
|
||||||
|
|
||||||
|
|
||||||
|
cd queue; mvn verify; cd ..
|
||||||
|
|
||||||
|
|
||||||
|
cd $ARTEMIS_HOME/examples/protocols/mqtt/
|
||||||
|
|
||||||
|
|
||||||
|
cd clustered-queue-mqtt; mvn verify; cd ..
|
||||||
|
cd publish-subscribe; mvn verify; cd ..
|
||||||
|
|
||||||
|
|
||||||
|
cd $ARTEMIS_HOME/examples/protocols/openwire/
|
||||||
|
|
||||||
|
|
||||||
|
cd queue; mvn verify; cd ..
|
||||||
|
cd message-listener; mvn verify; cd ..
|
||||||
|
cd message-recovery; mvn verify; cd ..
|
||||||
|
|
||||||
|
|
||||||
|
cd $ARTEMIS_HOME/examples/protocols/stomp/
|
||||||
|
|
||||||
|
|
||||||
|
cd stomp; mvn verify; cd ..
|
||||||
|
cd stomp1.1; mvn verify; cd ..
|
||||||
|
cd stomp1.2; mvn verify; cd ..
|
||||||
|
cd stomp-dual-authentication; mvn verify; cd ..
|
||||||
|
cd stomp-embedded-interceptor; mvn verify; cd ..
|
||||||
|
cd stomp-jms; mvn verify; cd ..
|
||||||
|
|
||||||
|
|
||||||
cd $CURRENT_DIR
|
cd $CURRENT_DIR
|
||||||
rm -rf target
|
rm -rf target
|
||||||
|
|
|
@ -30,12 +30,16 @@ export TEST_TARGET="./target"
|
||||||
|
|
||||||
cd $ARTEMIS_HOME/examples/features/standard/
|
cd $ARTEMIS_HOME/examples/features/standard/
|
||||||
|
|
||||||
cd bridge; mvn verify; cd ..
|
cd auto-closeable; mvn verify; cd ..
|
||||||
cd bridge; mvn verify; cd ..
|
|
||||||
cd browser; mvn verify; cd ..
|
|
||||||
cd broker-plugin; mvn verify; cd ..
|
cd broker-plugin; mvn verify; cd ..
|
||||||
|
cd browser; mvn verify; cd ..
|
||||||
|
cd cdi; mvn verify; cd ..
|
||||||
cd client-kickoff; mvn verify; cd ..
|
cd client-kickoff; mvn verify; cd ..
|
||||||
|
cd completion-listener; mvn verify; cd ..
|
||||||
cd consumer-rate-limit; mvn verify; cd ..
|
cd consumer-rate-limit; mvn verify; cd ..
|
||||||
|
cd context; mvn verify; cd ..
|
||||||
|
cd core-bridge; mvn verify; cd ..
|
||||||
|
cd database; mvn verify; cd ..
|
||||||
cd dead-letter; mvn verify; cd ..
|
cd dead-letter; mvn verify; cd ..
|
||||||
cd delayed-redelivery; mvn verify; cd ..
|
cd delayed-redelivery; mvn verify; cd ..
|
||||||
cd divert; mvn verify; cd ..
|
cd divert; mvn verify; cd ..
|
||||||
|
@ -44,15 +48,14 @@ cd embedded; mvn verify; cd ..
|
||||||
cd embedded-simple; mvn verify; cd ..
|
cd embedded-simple; mvn verify; cd ..
|
||||||
cd expiry; mvn verify; cd ..
|
cd expiry; mvn verify; cd ..
|
||||||
cd http-transport; mvn verify; cd ..
|
cd http-transport; mvn verify; cd ..
|
||||||
cd interceptor; mvn verify; cd ..
|
|
||||||
cd interceptor-client; mvn verify; cd ..
|
|
||||||
cd jms-auto-closeable; mvn verify; cd ..
|
|
||||||
cd instantiate-connection-factory; mvn verify; cd ..
|
cd instantiate-connection-factory; mvn verify; cd ..
|
||||||
|
cd interceptor; mvn verify; cd ..
|
||||||
|
cd interceptor-amqp; mvn verify; cd ..
|
||||||
|
cd interceptor-client; mvn verify; cd ..
|
||||||
|
cd interceptor-mqtt; mvn verify; cd ..
|
||||||
cd jms-bridge; mvn verify; cd ..
|
cd jms-bridge; mvn verify; cd ..
|
||||||
cd jms-completion-listener; mvn verify; cd ..
|
|
||||||
cd jms-context; mvn verify; cd ..
|
|
||||||
cd jms-shared-consumer; mvn verify; cd ..
|
|
||||||
cd jmx; mvn verify; cd ..
|
cd jmx; mvn verify; cd ..
|
||||||
|
cd jmx-ssl; mvn verify; cd ..
|
||||||
|
|
||||||
# too big for most CI machines
|
# too big for most CI machines
|
||||||
#cd large-message; mvn verify; cd ..
|
#cd large-message; mvn verify; cd ..
|
||||||
|
@ -78,15 +81,18 @@ cd scheduled-message; mvn verify; cd ..
|
||||||
cd security; mvn verify; cd ..
|
cd security; mvn verify; cd ..
|
||||||
cd security-ldap; mvn verify; cd ..
|
cd security-ldap; mvn verify; cd ..
|
||||||
cd send-acknowledgements; mvn verify; cd ..
|
cd send-acknowledgements; mvn verify; cd ..
|
||||||
|
cd shared-consumer; mvn verify; cd ..
|
||||||
|
cd slow-consumer; mvn verify; cd ..
|
||||||
cd spring-integration; mvn verify; cd ..
|
cd spring-integration; mvn verify; cd ..
|
||||||
cd ssl-enabled; mvn verify; cd ..
|
cd ssl-enabled; mvn verify; cd ..
|
||||||
|
cd ssl-enabled-crl-mqtt; mvn verify; cd ..
|
||||||
cd ssl-enabled-dual-authentication; mvn verify; cd ..
|
cd ssl-enabled-dual-authentication; mvn verify; cd ..
|
||||||
cd static-selector; mvn verify; cd ..
|
cd static-selector; mvn verify; cd ..
|
||||||
cd temp-queue; mvn verify; cd ..
|
cd temp-queue; mvn verify; cd ..
|
||||||
cd topic; mvn verify; cd ..
|
cd topic; mvn verify; cd ..
|
||||||
cd topic-hierarchies; mvn verify; cd ..
|
cd topic-hierarchies; mvn verify; cd ..
|
||||||
cd topic-selector-example1; mvn verify; cd ..
|
cd topic-selector1; mvn verify; cd ..
|
||||||
cd topic-selector-example2; mvn verify; cd ..
|
cd topic-selector2; mvn verify; cd ..
|
||||||
cd transactional; mvn verify; cd ..
|
cd transactional; mvn verify; cd ..
|
||||||
cd xa-heuristic; mvn verify; cd ..
|
cd xa-heuristic; mvn verify; cd ..
|
||||||
cd xa-receive; mvn verify; cd ..
|
cd xa-receive; mvn verify; cd ..
|
||||||
|
|
|
@ -871,7 +871,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String role : allRoles) {
|
for (String role : allRoles) {
|
||||||
securityRoles.add(new Role(role, send.contains(role), consume.contains(role), createDurableQueue.contains(role), deleteDurableQueue.contains(role), createNonDurableQueue.contains(role), deleteNonDurableQueue.contains(role), manageRoles.contains(role), browseRoles.contains(role)));
|
securityRoles.add(new Role(role, send.contains(role), consume.contains(role), createDurableQueue.contains(role), deleteDurableQueue.contains(role), createNonDurableQueue.contains(role), deleteNonDurableQueue.contains(role), manageRoles.contains(role), browseRoles.contains(role), createAddressRoles.contains(role), deleteAddressRoles.contains(role)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return securityMatch;
|
return securityMatch;
|
||||||
|
|
|
@ -366,8 +366,18 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin {
|
||||||
Rdn rdn = ldapname.getRdn(ldapname.size() - 1);
|
Rdn rdn = ldapname.getRdn(ldapname.size() - 1);
|
||||||
String roleName = rdn.getValue().toString();
|
String roleName = rdn.getValue().toString();
|
||||||
logger.debug("\tRole name: " + roleName);
|
logger.debug("\tRole name: " + roleName);
|
||||||
Role role = new Role(roleName, permissionType.equalsIgnoreCase(writePermissionValue), permissionType.equalsIgnoreCase(readPermissionValue), permissionType.equalsIgnoreCase(adminPermissionValue), permissionType.equalsIgnoreCase(adminPermissionValue), permissionType.equalsIgnoreCase(adminPermissionValue), permissionType.equalsIgnoreCase(adminPermissionValue), false, // there is no permission from ActiveMQ 5.x that corresponds to the "manage" permission in ActiveMQ Artemis
|
Role role = new Role(roleName,
|
||||||
permissionType.equalsIgnoreCase(readPermissionValue)); // the "browse" permission matches "read" from ActiveMQ 5.x
|
permissionType.equalsIgnoreCase(writePermissionValue), // send
|
||||||
|
permissionType.equalsIgnoreCase(readPermissionValue), // consume
|
||||||
|
permissionType.equalsIgnoreCase(adminPermissionValue), // createDurableQueue
|
||||||
|
permissionType.equalsIgnoreCase(adminPermissionValue), // deleteDurableQueue
|
||||||
|
permissionType.equalsIgnoreCase(adminPermissionValue), // createNonDurableQueue
|
||||||
|
permissionType.equalsIgnoreCase(adminPermissionValue), // deleteNonDurableQueue
|
||||||
|
false, // manage - there is no permission from ActiveMQ 5.x that corresponds to this
|
||||||
|
permissionType.equalsIgnoreCase(readPermissionValue), // browse
|
||||||
|
permissionType.equalsIgnoreCase(adminPermissionValue), // createAddress
|
||||||
|
permissionType.equalsIgnoreCase(adminPermissionValue) // deleteAddress
|
||||||
|
);
|
||||||
roles.add(role);
|
roles.add(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -508,63 +508,62 @@ public class FileConfigurationTest extends ConfigurationImplTest {
|
||||||
Map<String, Set<Role>> securityRoles = fc.getSecurityRoles();
|
Map<String, Set<Role>> securityRoles = fc.getSecurityRoles();
|
||||||
Set<Role> roles = securityRoles.get("#");
|
Set<Role> roles = securityRoles.get("#");
|
||||||
|
|
||||||
//N.B. - FileConfigurationParser uses the constructor without createAddress and deleteAddress
|
|
||||||
//cn=mygroup,dc=local,dc=com = amq1
|
//cn=mygroup,dc=local,dc=com = amq1
|
||||||
Role testRole1 = new Role("cn=mygroup,dc=local,dc=com",false, false, false,
|
Role testRole1 = new Role("cn=mygroup,dc=local,dc=com",false, false, false,
|
||||||
false, true, false, false,
|
false, true, false, false,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
//myrole1 = amq1 + amq2
|
//myrole1 = amq1 + amq2
|
||||||
Role testRole2 = new Role("myrole1",false, false, false,
|
Role testRole2 = new Role("myrole1",false, false, false,
|
||||||
false, true, true, false,
|
false, true, true, false,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
//myrole3 = amq3 + amq4
|
//myrole3 = amq3 + amq4
|
||||||
Role testRole3 = new Role("myrole3",false, false, true,
|
Role testRole3 = new Role("myrole3",false, false, true,
|
||||||
true, false, false, false,
|
true, false, false, false,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
//myrole4 = amq5 + amq!@#$%^&*() + amq6
|
//myrole4 = amq5 + amq!@#$%^&*() + amq6
|
||||||
Role testRole4 = new Role("myrole4",true, true, false,
|
Role testRole4 = new Role("myrole4",true, true, false,
|
||||||
false, false, false, false,
|
false, false, false, false,
|
||||||
true);
|
true, true, true);
|
||||||
|
|
||||||
//myrole5 = amq4 = amq3 + amq4
|
//myrole5 = amq4 = amq3 + amq4
|
||||||
Role testRole5 = new Role("myrole5",false, false, true,
|
Role testRole5 = new Role("myrole5",false, false, true,
|
||||||
true, false, false, false,
|
true, false, false, false,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
Role testRole6 = new Role("amq1",false, false, false,
|
Role testRole6 = new Role("amq1",false, false, false,
|
||||||
false, true, false, false,
|
false, true, false, false,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
Role testRole7 = new Role("amq2",false, false, false,
|
Role testRole7 = new Role("amq2",false, false, false,
|
||||||
false, false, true, false,
|
false, false, true, false,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
Role testRole8 = new Role("amq3",false, false, true,
|
Role testRole8 = new Role("amq3",false, false, true,
|
||||||
false, false, false, false,
|
false, false, false, false,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
Role testRole9 = new Role("amq4",false, false, true,
|
Role testRole9 = new Role("amq4",false, false, true,
|
||||||
true, false, false, false,
|
true, false, false, false,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
Role testRole10 = new Role("amq5",false, false, false,
|
Role testRole10 = new Role("amq5",false, false, false,
|
||||||
false, false, false, false,
|
false, false, false, false,
|
||||||
false);
|
false, true, true);
|
||||||
|
|
||||||
Role testRole11 = new Role("amq6",false, true, false,
|
Role testRole11 = new Role("amq6",false, true, false,
|
||||||
false, false, false, false,
|
false, false, false, false,
|
||||||
true);
|
true, false, false);
|
||||||
|
|
||||||
Role testRole12 = new Role("amq7",false, false, false,
|
Role testRole12 = new Role("amq7",false, false, false,
|
||||||
false, false, false, true,
|
false, false, false, true,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
Role testRole13 = new Role("amq!@#$%^&*()",true, false, false,
|
Role testRole13 = new Role("amq!@#$%^&*()",true, false, false,
|
||||||
false, false, false, false,
|
false, false, false, false,
|
||||||
false);
|
false, false, false);
|
||||||
|
|
||||||
assertEquals(13, roles.size());
|
assertEquals(13, roles.size());
|
||||||
assertTrue(roles.contains(testRole1));
|
assertTrue(roles.contains(testRole1));
|
||||||
|
|
|
@ -35,6 +35,12 @@ wildcard match can be used using the wildcard characters '`#`' and
|
||||||
Eight different permissions can be given to the set of queues which
|
Eight different permissions can be given to the set of queues which
|
||||||
match the address. Those permissions are:
|
match the address. Those permissions are:
|
||||||
|
|
||||||
|
- `createAddress`. This permission allows the user to create an
|
||||||
|
address fitting the `match`.
|
||||||
|
|
||||||
|
- `deleteAddress`. This permission allows the user to delete an
|
||||||
|
address fitting the `match`.
|
||||||
|
|
||||||
- `createDurableQueue`. This permission allows the user to create a
|
- `createDurableQueue`. This permission allows the user to create a
|
||||||
durable queue under matching addresses.
|
durable queue under matching addresses.
|
||||||
|
|
||||||
|
@ -225,13 +231,14 @@ The name of the queue or topic defined in LDAP will serve as the "match" for the
|
||||||
will be mapped from the ActiveMQ 5.x type to the Artemis type, and the role will be mapped as-is.
|
will be mapped from the ActiveMQ 5.x type to the Artemis type, and the role will be mapped as-is.
|
||||||
|
|
||||||
ActiveMQ 5.x only has 3 permission types - `read`, `write`, and `admin`. These permission types are described on their
|
ActiveMQ 5.x only has 3 permission types - `read`, `write`, and `admin`. These permission types are described on their
|
||||||
[website](http://activemq.apache.org/security.html). However, as described previously, ActiveMQ Artemis has 7 permission
|
[website](http://activemq.apache.org/security.html). However, as described previously, ActiveMQ Artemis has 9 permission
|
||||||
types - `createDurableQueue`, `deleteDurableQueue`, `createNonDurableQueue`, `deleteNonDurableQueue`, `send`, `consume`,
|
types - `createAddress`, `deleteAddress`, `createDurableQueue`, `deleteDurableQueue`, `createNonDurableQueue`,
|
||||||
`browse`, and `manage`. Here's how the old types are mapped to the new types:
|
`deleteNonDurableQueue`, `send`, `consume`, `browse`, and `manage`. Here's how the old types are mapped to the new types:
|
||||||
|
|
||||||
- `read` - `consume`, `browse`
|
- `read` - `consume`, `browse`
|
||||||
- `write` - `send`
|
- `write` - `send`
|
||||||
- `admin` - `createDurableQueue`, `deleteDurableQueue`, `createNonDurableQueue`, `deleteNonDurableQueue`
|
- `admin` - `createAddress`, `deleteAddress`, `createDurableQueue`, `deleteDurableQueue`, `createNonDurableQueue`,
|
||||||
|
`deleteNonDurableQueue`
|
||||||
|
|
||||||
As mentioned, there are a few places where a translation was performed to achieve some equivalence.:
|
As mentioned, there are a few places where a translation was performed to achieve some equivalence.:
|
||||||
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
Running the ActiveMQ Artemis Examples
|
|
||||||
============================
|
|
||||||
|
|
||||||
To run an individual example firstly cd into the example directory and run
|
|
||||||
|
|
||||||
```sh
|
|
||||||
mvn verify
|
|
||||||
```
|
|
||||||
|
|
||||||
Most examples offer a way to start them without creating and starting the broker (say if you want to do it manually)
|
|
||||||
|
|
||||||
```sh
|
|
||||||
mvn verify -PnoServer
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are running against an un released version, i.e. from master branch, you will have to run `mvn install` on the root
|
|
||||||
pom.xml and the example/activemq-jms-examples-common/pom.xml first.
|
|
||||||
|
|
||||||
If you want to run all the examples (except those that need to be run standalone) you can run `mvn verify -Pexamples` in the examples
|
|
||||||
directory but before you do you will need to up the memory used by running:
|
|
||||||
|
|
||||||
```
|
|
||||||
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m"
|
|
||||||
```
|
|
||||||
### Recreating the examples
|
|
||||||
|
|
||||||
If you are trying to copy the examples somewhere else and modifying them. Consider asking Maven to explicitly list all the dependencies:
|
|
||||||
|
|
||||||
```
|
|
||||||
# if trying to modify the 'topic' example:
|
|
||||||
cd examples/jms/topic && mvn dependency:list
|
|
||||||
```
|
|
|
@ -27,7 +27,7 @@
|
||||||
<version>2.5.0-SNAPSHOT</version>
|
<version>2.5.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>artemis-cdi-example</artifactId>
|
<artifactId>cdi</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>ActiveMQ Artemis CDI Example</name>
|
<name>ActiveMQ Artemis CDI Example</name>
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.activemq.examples.broker</groupId>
|
<groupId>org.apache.activemq.examples.broker</groupId>
|
||||||
<artifactId>artemis-cdi-example</artifactId>
|
<artifactId>cdi</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -27,9 +27,9 @@ under the License.
|
||||||
<version>2.5.0-SNAPSHOT</version>
|
<version>2.5.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>datatabase</artifactId>
|
<artifactId>database</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>ActiveMQ Artemis JMS Expiry Example</name>
|
<name>ActiveMQ Artemis JMS Database Example</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
||||||
|
@ -104,7 +104,7 @@ under the License.
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.activemq.examples.broker</groupId>
|
<groupId>org.apache.activemq.examples.broker</groupId>
|
||||||
<artifactId>datatabase</artifactId>
|
<artifactId>database</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -4,4 +4,6 @@ To run the example, simply type **mvn verify** from this directory, or **mvn -Pn
|
||||||
|
|
||||||
This example shows you how to configure ActiveMQ Artemis to run with a database.
|
This example shows you how to configure ActiveMQ Artemis to run with a database.
|
||||||
|
|
||||||
Notice this is not making any assumption of what is the recommended database to be used with Artemis. After all we recommend the artemis journal to be used, however in certain environments users will prefer databases for specific reasons.
|
### Notice
|
||||||
|
|
||||||
|
This is not making any assumption of what is the recommended database to be used with Artemis. We generally recommend the Artemis journal to be used. However, in certain environments users will prefer databases for specific reasons.
|
||||||
|
|
|
@ -18,10 +18,7 @@ specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:activemq" xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
|
||||||
xmlns="urn:activemq"
|
|
||||||
xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
|
|
||||||
|
|
||||||
<core xmlns="urn:activemq:core">
|
<core xmlns="urn:activemq:core">
|
||||||
|
|
||||||
<persistence-enabled>false</persistence-enabled>
|
<persistence-enabled>false</persistence-enabled>
|
||||||
|
@ -30,11 +27,9 @@ under the License.
|
||||||
<acceptor name="in-vm">vm://0</acceptor>
|
<acceptor name="in-vm">vm://0</acceptor>
|
||||||
</acceptors>
|
</acceptors>
|
||||||
|
|
||||||
<!-- Other config -->
|
|
||||||
|
|
||||||
<security-settings>
|
<security-settings>
|
||||||
<!--security for example queue-->
|
|
||||||
<security-setting match="#">
|
<security-setting match="#">
|
||||||
|
<permission type="createAddress" roles="guest"/>
|
||||||
<permission type="createDurableQueue" roles="guest"/>
|
<permission type="createDurableQueue" roles="guest"/>
|
||||||
<permission type="deleteDurableQueue" roles="guest"/>
|
<permission type="deleteDurableQueue" roles="guest"/>
|
||||||
<permission type="createNonDurableQueue" roles="guest"/>
|
<permission type="createNonDurableQueue" roles="guest"/>
|
||||||
|
@ -43,6 +38,5 @@ under the License.
|
||||||
<permission type="send" roles="guest"/>
|
<permission type="send" roles="guest"/>
|
||||||
</security-setting>
|
</security-setting>
|
||||||
</security-settings>
|
</security-settings>
|
||||||
|
|
||||||
</core>
|
</core>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -27,7 +27,7 @@ under the License.
|
||||||
<version>2.5.0-SNAPSHOT</version>
|
<version>2.5.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bridge</artifactId>
|
<artifactId>jms-bridge</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>ActiveMQ Artemis JMS Bridge Example</name>
|
<name>ActiveMQ Artemis JMS Bridge Example</name>
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ under the License.
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.activemq.examples.broker</groupId>
|
<groupId>org.apache.activemq.examples.broker</groupId>
|
||||||
<artifactId>bridge</artifactId>
|
<artifactId>jms-bridge</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -14,6 +14,15 @@ To access this MBeanServer remotely, add the following to the management.xml con
|
||||||
|
|
||||||
With these properties, ActiveMQ Artemis broker will be manageable remotely using standard JMX URL on port `1099`.
|
With these properties, ActiveMQ Artemis broker will be manageable remotely using standard JMX URL on port `1099`.
|
||||||
|
|
||||||
|
The various keystore files are generated using the following commands:
|
||||||
|
|
||||||
|
* `keytool -genkey -keystore server-side-keystore.jks -storepass secureexample -keypass secureexample -dname "CN=ActiveMQ Artemis Server, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA`
|
||||||
|
* `keytool -export -keystore server-side-keystore.jks -file server-side-cert.cer -storepass secureexample`
|
||||||
|
* `keytool -import -keystore client-side-truststore.jks -file server-side-cert.cer -storepass secureexample -keypass secureexample -noprompt`
|
||||||
|
* `keytool -genkey -keystore client-side-keystore.jks -storepass secureexample -keypass secureexample -dname "CN=ActiveMQ Artemis Client, OU=Artemis, O=ActiveMQ, L=AMQ, S=AMQ, C=AMQ" -keyalg RSA`
|
||||||
|
* `keytool -export -keystore client-side-keystore.jks -file client-side-cert.cer -storepass secureexample`
|
||||||
|
* `keytool -import -keystore server-side-truststore.jks -file client-side-cert.cer -storepass secureexample -keypass secureexample -noprompt`
|
||||||
|
|
||||||
## More information
|
## More information
|
||||||
|
|
||||||
* [Java management guide](https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html)
|
* [Java management guide](https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html)
|
|
@ -83,10 +83,10 @@ public class JMXOverSSLExample {
|
||||||
String[] creds = {"guest", "guest"};
|
String[] creds = {"guest", "guest"};
|
||||||
env.put(JMXConnector.CREDENTIALS, creds);
|
env.put(JMXConnector.CREDENTIALS, creds);
|
||||||
|
|
||||||
System.setProperty("javax.net.ssl.trustStore", args[0] + "activemq.example.truststore");
|
System.setProperty("javax.net.ssl.trustStore", args[0] + "client-side-truststore.jks");
|
||||||
System.setProperty("javax.net.ssl.trustStorePassword", "activemqexample");
|
System.setProperty("javax.net.ssl.trustStorePassword", "secureexample");
|
||||||
System.setProperty("javax.net.ssl.keyStore", args[0] + "activemq.example.keystore");
|
System.setProperty("javax.net.ssl.keyStore", args[0] + "client-side-keystore.jks");
|
||||||
System.setProperty("javax.net.ssl.keyStorePassword", "activemqexample");
|
System.setProperty("javax.net.ssl.keyStorePassword", "secureexample");
|
||||||
|
|
||||||
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMXOverSSLExample.JMX_URL), env);
|
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMXOverSSLExample.JMX_URL), env);
|
||||||
|
|
||||||
|
@ -131,6 +131,11 @@ public class JMXOverSSLExample {
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
connection.close();
|
connection.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.clearProperty("javax.net.ssl.trustStore");
|
||||||
|
System.clearProperty("javax.net.ssl.trustStorePassword");
|
||||||
|
System.clearProperty("javax.net.ssl.keyStore");
|
||||||
|
System.clearProperty("javax.net.ssl.keyStorePassword");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -20,10 +20,10 @@
|
||||||
connector-port="1099"
|
connector-port="1099"
|
||||||
connector-host="localhost"
|
connector-host="localhost"
|
||||||
secured="true"
|
secured="true"
|
||||||
key-store-path="${data.dir}/../etc/activemq.example.keystore"
|
key-store-path="${data.dir}/../etc/server-side-keystore.jks"
|
||||||
key-store-password="activemqexample"
|
key-store-password="secureexample"
|
||||||
trust-store-path="${data.dir}/../etc/activemq.example.truststore"
|
trust-store-path="${data.dir}/../etc/server-side-truststore.jks"
|
||||||
trust-store-password="activemqexample"/>
|
trust-store-password="secureexample"/>
|
||||||
<authorisation>
|
<authorisation>
|
||||||
<whitelist>
|
<whitelist>
|
||||||
<entry domain="hawtio"/>
|
<entry domain="hawtio"/>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -41,12 +41,15 @@ under the License.
|
||||||
<profile>
|
<profile>
|
||||||
<id>release</id>
|
<id>release</id>
|
||||||
<modules>
|
<modules>
|
||||||
<module>bridge</module>
|
<module>auto-closeable</module>
|
||||||
<module>browser</module>
|
<module>browser</module>
|
||||||
<module>broker-plugin</module>
|
<module>broker-plugin</module>
|
||||||
<module>cdi</module>
|
<module>cdi</module>
|
||||||
<module>client-kickoff</module>
|
<module>client-kickoff</module>
|
||||||
|
<module>completion-listener</module>
|
||||||
<module>consumer-rate-limit</module>
|
<module>consumer-rate-limit</module>
|
||||||
|
<module>context</module>
|
||||||
|
<module>core-bridge</module>
|
||||||
<module>database</module>
|
<module>database</module>
|
||||||
<module>dead-letter</module>
|
<module>dead-letter</module>
|
||||||
<module>delayed-redelivery</module>
|
<module>delayed-redelivery</module>
|
||||||
|
@ -61,11 +64,7 @@ under the License.
|
||||||
<module>interceptor-mqtt</module>
|
<module>interceptor-mqtt</module>
|
||||||
<module>interceptor-amqp</module>
|
<module>interceptor-amqp</module>
|
||||||
<module>instantiate-connection-factory</module>
|
<module>instantiate-connection-factory</module>
|
||||||
<module>jms-auto-closeable</module>
|
|
||||||
<module>jms-bridge</module>
|
<module>jms-bridge</module>
|
||||||
<module>jms-completion-listener</module>
|
|
||||||
<module>jms-context</module>
|
|
||||||
<module>jms-shared-consumer</module>
|
|
||||||
<module>jmx</module>
|
<module>jmx</module>
|
||||||
<module>jmx-ssl</module>
|
<module>jmx-ssl</module>
|
||||||
<module>large-message</module>
|
<module>large-message</module>
|
||||||
|
@ -90,32 +89,36 @@ under the License.
|
||||||
<module>security</module>
|
<module>security</module>
|
||||||
<module>security-ldap</module>
|
<module>security-ldap</module>
|
||||||
<module>send-acknowledgements</module>
|
<module>send-acknowledgements</module>
|
||||||
|
<module>shared-consumer</module>
|
||||||
<module>slow-consumer</module>
|
<module>slow-consumer</module>
|
||||||
<module>spring-integration</module>
|
<module>spring-integration</module>
|
||||||
<module>ssl-enabled</module>
|
<module>ssl-enabled</module>
|
||||||
|
<module>ssl-enabled-crl-mqtt</module>
|
||||||
<module>ssl-enabled-dual-authentication</module>
|
<module>ssl-enabled-dual-authentication</module>
|
||||||
<module>static-selector</module>
|
<module>static-selector</module>
|
||||||
<module>temp-queue</module>
|
<module>temp-queue</module>
|
||||||
<module>topic</module>
|
<module>topic</module>
|
||||||
<module>topic-hierarchies</module>
|
<module>topic-hierarchies</module>
|
||||||
<module>topic-selector-example1</module>
|
<module>topic-selector1</module>
|
||||||
<module>topic-selector-example2</module>
|
<module>topic-selector2</module>
|
||||||
<module>transactional</module>
|
<module>transactional</module>
|
||||||
<module>xa-heuristic</module>
|
<module>xa-heuristic</module>
|
||||||
<module>xa-receive</module>
|
<module>xa-receive</module>
|
||||||
<module>xa-send</module>
|
<module>xa-send</module>
|
||||||
<module>ssl-enabled-crl-mqtt</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>examples</id>
|
<id>examples</id>
|
||||||
<modules>
|
<modules>
|
||||||
<module>bridge</module>
|
<module>auto-closeable</module>
|
||||||
<module>browser</module>
|
<module>browser</module>
|
||||||
<module>broker-plugin</module>
|
<module>broker-plugin</module>
|
||||||
<module>cdi</module>
|
<module>cdi</module>
|
||||||
<module>client-kickoff</module>
|
<module>client-kickoff</module>
|
||||||
|
<module>completion-listener</module>
|
||||||
<module>consumer-rate-limit</module>
|
<module>consumer-rate-limit</module>
|
||||||
|
<module>context</module>
|
||||||
|
<module>core-bridge</module>
|
||||||
<module>database</module>
|
<module>database</module>
|
||||||
<module>dead-letter</module>
|
<module>dead-letter</module>
|
||||||
<module>delayed-redelivery</module>
|
<module>delayed-redelivery</module>
|
||||||
|
@ -129,12 +132,8 @@ under the License.
|
||||||
<module>interceptor-client</module>
|
<module>interceptor-client</module>
|
||||||
<module>interceptor-mqtt</module>
|
<module>interceptor-mqtt</module>
|
||||||
<module>interceptor-amqp</module>
|
<module>interceptor-amqp</module>
|
||||||
<module>jms-auto-closeable</module>
|
|
||||||
<module>instantiate-connection-factory</module>
|
<module>instantiate-connection-factory</module>
|
||||||
<module>jms-bridge</module>
|
<module>jms-bridge</module>
|
||||||
<module>jms-completion-listener</module>
|
|
||||||
<module>jms-context</module>
|
|
||||||
<module>jms-shared-consumer</module>
|
|
||||||
<module>jmx</module>
|
<module>jmx</module>
|
||||||
<module>jmx-ssl</module>
|
<module>jmx-ssl</module>
|
||||||
<module>large-message</module>
|
<module>large-message</module>
|
||||||
|
@ -153,16 +152,17 @@ under the License.
|
||||||
<module>queue-requestor</module>
|
<module>queue-requestor</module>
|
||||||
<module>queue-selector</module>
|
<module>queue-selector</module>
|
||||||
<module>reattach-node</module>
|
<module>reattach-node</module>
|
||||||
|
|
||||||
<module>request-reply</module>
|
|
||||||
<module>rest</module>
|
<module>rest</module>
|
||||||
|
<module>request-reply</module>
|
||||||
<module>scheduled-message</module>
|
<module>scheduled-message</module>
|
||||||
<module>security</module>
|
<module>security</module>
|
||||||
<module>security-ldap</module>
|
<module>security-ldap</module>
|
||||||
<module>send-acknowledgements</module>
|
<module>send-acknowledgements</module>
|
||||||
|
<module>shared-consumer</module>
|
||||||
<module>slow-consumer</module>
|
<module>slow-consumer</module>
|
||||||
<module>spring-integration</module>
|
<module>spring-integration</module>
|
||||||
<module>ssl-enabled</module>
|
<module>ssl-enabled</module>
|
||||||
|
<module>ssl-enabled-crl-mqtt</module>
|
||||||
<module>ssl-enabled-dual-authentication</module>
|
<module>ssl-enabled-dual-authentication</module>
|
||||||
<module>static-selector</module>
|
<module>static-selector</module>
|
||||||
|
|
||||||
|
@ -172,13 +172,12 @@ under the License.
|
||||||
<module>temp-queue</module>
|
<module>temp-queue</module>
|
||||||
<module>topic</module>
|
<module>topic</module>
|
||||||
<module>topic-hierarchies</module>
|
<module>topic-hierarchies</module>
|
||||||
<module>topic-selector-example1</module>
|
<module>topic-selector1</module>
|
||||||
<module>topic-selector-example2</module>
|
<module>topic-selector2</module>
|
||||||
<module>transactional</module>
|
<module>transactional</module>
|
||||||
<module>xa-heuristic</module>
|
<module>xa-heuristic</module>
|
||||||
<module>xa-receive</module>
|
<module>xa-receive</module>
|
||||||
<module>xa-send</module>
|
<module>xa-send</module>
|
||||||
<module>ssl-enabled-crl-mqtt</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
-->
|
-->
|
||||||
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
|
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
|
||||||
|
<core xmlns="urn:activemq:core">
|
||||||
<bindings-directory>./data/messaging/bindings</bindings-directory>
|
<bindings-directory>./data/messaging/bindings</bindings-directory>
|
||||||
|
|
||||||
<journal-directory>./data/messaging/journal</journal-directory>
|
<journal-directory>./data/messaging/journal</journal-directory>
|
||||||
|
|
|
@ -37,6 +37,7 @@ under the License.
|
||||||
<security-settings>
|
<security-settings>
|
||||||
<!--security for example queues -->
|
<!--security for example queues -->
|
||||||
<security-setting match="#">
|
<security-setting match="#">
|
||||||
|
<permission roles="guest" type="deleteAddress"/>
|
||||||
<permission roles="guest" type="createDurableQueue"/>
|
<permission roles="guest" type="createDurableQueue"/>
|
||||||
<permission roles="guest" type="deleteDurableQueue"/>
|
<permission roles="guest" type="deleteDurableQueue"/>
|
||||||
<permission roles="guest" type="createNonDurableQueue"/>
|
<permission roles="guest" type="createNonDurableQueue"/>
|
||||||
|
@ -44,20 +45,6 @@ under the License.
|
||||||
<permission roles="guest" type="consume"/>
|
<permission roles="guest" type="consume"/>
|
||||||
<permission roles="guest" type="send"/>
|
<permission roles="guest" type="send"/>
|
||||||
</security-setting>
|
</security-setting>
|
||||||
<!-- security settings for JMS temporary queue -->
|
|
||||||
<security-setting match="#">
|
|
||||||
<permission roles="guest" type="createNonDurableQueue"/>
|
|
||||||
<permission roles="guest" type="deleteNonDurableQueue"/>
|
|
||||||
<permission roles="guest" type="consume"/>
|
|
||||||
<permission roles="guest" type="send"/>
|
|
||||||
</security-setting>
|
|
||||||
</security-settings>
|
</security-settings>
|
||||||
<addresses>
|
|
||||||
<address name="exampleQueue">
|
|
||||||
<anycast>
|
|
||||||
<queue name="jms.queue.exampleQueue"/>
|
|
||||||
</anycast>
|
|
||||||
</address>
|
|
||||||
</addresses>
|
|
||||||
</core>
|
</core>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -56,8 +56,9 @@ under the License.
|
||||||
<profile>
|
<profile>
|
||||||
<id>examples</id>
|
<id>examples</id>
|
||||||
<modules>
|
<modules>
|
||||||
<!-- this one to be run manually
|
<!-- these to be run manually
|
||||||
<module>proton-cpp</module> -->
|
<module>proton-cpp</module>
|
||||||
|
<module>proton-clustered-cpp</module> -->
|
||||||
|
|
||||||
<module>queue</module>
|
<module>queue</module>
|
||||||
<module>proton-ruby</module>
|
<module>proton-ruby</module>
|
||||||
|
|
|
@ -29,7 +29,7 @@ under the License.
|
||||||
|
|
||||||
<artifactId>clustered-queue-mqtt</artifactId>
|
<artifactId>clustered-queue-mqtt</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>ActiveMQ Artemis JMS Clustered Queue Example</name>
|
<name>ActiveMQ Artemis MQTT Clustered Queue Example</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
||||||
|
@ -117,7 +117,7 @@ under the License.
|
||||||
<goal>runClient</goal>
|
<goal>runClient</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<clientClass>org.apache.activemq.artemis.jms.example.ClusteredQueueMQTTExample</clientClass>
|
<clientClass>org.apache.activemq.artemis.mqtt.example.ClusteredQueueMQTTExample</clientClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -149,7 +149,7 @@ under the License.
|
||||||
</executions>
|
</executions>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.activemq.examples.clustered</groupId>
|
<groupId>org.apache.activemq.examples.mqtt</groupId>
|
||||||
<artifactId>clustered-queue-mqtt</artifactId>
|
<artifactId>clustered-queue-mqtt</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.artemis.jms.example;
|
package org.apache.activemq.artemis.mqtt.example;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.fusesource.mqtt.client.BlockingConnection;
|
import org.fusesource.mqtt.client.BlockingConnection;
|
|
@ -40,15 +40,15 @@ under the License.
|
||||||
<profile>
|
<profile>
|
||||||
<id>release</id>
|
<id>release</id>
|
||||||
<modules>
|
<modules>
|
||||||
<module>basic-pubsub</module>
|
|
||||||
<module>clustered-queue-mqtt</module>
|
<module>clustered-queue-mqtt</module>
|
||||||
|
<module>publish-subscribe</module>
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>examples</id>
|
<id>examples</id>
|
||||||
<modules>
|
<modules>
|
||||||
<module>basic-pubsub</module>
|
|
||||||
<module>clustered-queue-mqtt</module>
|
<module>clustered-queue-mqtt</module>
|
||||||
|
<module>publish-subscribe</module>
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
|
@ -27,9 +27,9 @@ under the License.
|
||||||
<version>2.5.0-SNAPSHOT</version>
|
<version>2.5.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>artemis-mqtt-publish-example</artifactId>
|
<artifactId>publish-subscribe</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>ActiveMQ Artemis MQTT Publish Example</name>
|
<name>ActiveMQ Artemis MQTT Publish/Subscribe Example</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
||||||
|
@ -60,6 +60,7 @@ under the License.
|
||||||
<goal>cli</goal>
|
<goal>cli</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<ignore>${noServer}</ignore>
|
||||||
<spawn>true</spawn>
|
<spawn>true</spawn>
|
||||||
<testURI>tcp://localhost:61616</testURI>
|
<testURI>tcp://localhost:61616</testURI>
|
||||||
<args>
|
<args>
|
||||||
|
@ -73,10 +74,7 @@ under the License.
|
||||||
<goal>runClient</goal>
|
<goal>runClient</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<clientClass>org.apache.activemq.artemis.mqtt.example.MQTTBasicPubSubExample</clientClass>
|
<clientClass>org.apache.activemq.artemis.mqtt.example.MQTTPublishSubscribeExample</clientClass>
|
||||||
<args>
|
|
||||||
<param>${basedir}/target/server0</param>
|
|
||||||
</args>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -85,6 +83,7 @@ under the License.
|
||||||
<goal>cli</goal>
|
<goal>cli</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<ignore>${noServer}</ignore>
|
||||||
<args>
|
<args>
|
||||||
<param>stop</param>
|
<param>stop</param>
|
||||||
</args>
|
</args>
|
||||||
|
@ -94,7 +93,7 @@ under the License.
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.activemq.examples.mqtt</groupId>
|
<groupId>org.apache.activemq.examples.mqtt</groupId>
|
||||||
<artifactId>artemis-mqtt-publish-example</artifactId>
|
<artifactId>publish-subscribe</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
|
@ -1,4 +1,4 @@
|
||||||
# MQTT Example
|
# MQTT Publish/Subscribe Example
|
||||||
|
|
||||||
This is a basic MQTT example that demonstrates how to setup and connect to an Apache Artemis broker and send and receive messages using the MQTT protocol.
|
This is a basic MQTT example that demonstrates how to setup and connect to an Apache Artemis broker and send and receive messages using the MQTT protocol.
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.fusesource.mqtt.client.Topic;
|
||||||
/**
|
/**
|
||||||
* A simple MQTT publish and subscribe example.
|
* A simple MQTT publish and subscribe example.
|
||||||
*/
|
*/
|
||||||
public class MQTTBasicPubSubExample {
|
public class MQTTPublishSubscribeExample {
|
||||||
|
|
||||||
public static void main(final String[] args) throws Exception {
|
public static void main(final String[] args) throws Exception {
|
||||||
// Create a new MQTT connection to the broker. We are not setting the client ID. The broker will pick one for us.
|
// Create a new MQTT connection to the broker. We are not setting the client ID. The broker will pick one for us.
|
|
@ -29,7 +29,7 @@ under the License.
|
||||||
|
|
||||||
<artifactId>message-listener</artifactId>
|
<artifactId>message-listener</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>ActiveMQ Artemis JMS Queue Example for openwire</name>
|
<name>ActiveMQ Artemis OpenWire JMS Message Listener Example</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
||||||
|
@ -84,7 +84,7 @@ under the License.
|
||||||
<goal>runClient</goal>
|
<goal>runClient</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<clientClass>org.apache.activemq.artemis.jms.example.QueueExample</clientClass>
|
<clientClass>org.apache.activemq.artemis.jms.example.MessageListenerExample</clientClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# JMS Queue Message Listener for OpenWire
|
# OpenWire JMS Message Listener Example
|
||||||
|
|
||||||
To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify** if you want to start and create the broker manually.
|
To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify** if you want to start and create the broker manually.
|
||||||
|
|
||||||
This example shows how to use a MessageListener with the OpenWire client
|
This example shows how to use a MessageListener with the OpenWire client.
|
|
@ -30,10 +30,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
|
|
||||||
/**
|
public class MessageListenerExample {
|
||||||
* A simple JMS Queue example that creates a producer and consumer on a queue and sends then receives a message.
|
|
||||||
*/
|
|
||||||
public class QueueExample {
|
|
||||||
|
|
||||||
public static void main(final String[] args) throws Exception {
|
public static void main(final String[] args) throws Exception {
|
||||||
Connection connection = null;
|
Connection connection = null;
|
|
@ -29,7 +29,7 @@ under the License.
|
||||||
|
|
||||||
<artifactId>message-recovery</artifactId>
|
<artifactId>message-recovery</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>ActiveMQ Artemis JMS Queue Example for openwire</name>
|
<name>ActiveMQ Artemis OpenWire JMS Message Recovery Example</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
||||||
|
@ -79,7 +79,7 @@ under the License.
|
||||||
<goal>runClient</goal>
|
<goal>runClient</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<clientClass>org.apache.activemq.artemis.jms.example.QueueExample</clientClass>
|
<clientClass>org.apache.activemq.artemis.jms.example.MessageRecoveryExample</clientClass>
|
||||||
<args>
|
<args>
|
||||||
<param>${basedir}/target/server0</param>
|
<param>${basedir}/target/server0</param>
|
||||||
</args>
|
</args>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# JMS Queue Message Listener for OpenWire
|
# OpenWire JMS Message Recovery Example
|
||||||
|
|
||||||
This example will start and stop the broker within the example.
|
This example will start and stop the broker within the example.
|
||||||
|
|
||||||
This example shows how to use send messages to a queue, and having these messages recovered from the journal.
|
This example shows how to use send messages to a queue and having these messages recovered from the journal when the broker is restarted.
|
|
@ -31,16 +31,13 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.artemis.util.ServerUtil;
|
import org.apache.activemq.artemis.util.ServerUtil;
|
||||||
|
|
||||||
/**
|
public class MessageRecoveryExample {
|
||||||
* A simple JMS Queue example that creates a producer and consumer on a queue and sends then receives a message.
|
|
||||||
*/
|
|
||||||
public class QueueExample {
|
|
||||||
|
|
||||||
public static void main(final String[] args) throws Exception {
|
public static void main(final String[] args) throws Exception {
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
Process server0 = null;
|
Process server0 = null;
|
||||||
try {
|
try {
|
||||||
server0 = ServerUtil.startServer(args[0], QueueExample.class.getSimpleName() + "0", 0, 5000);
|
server0 = ServerUtil.startServer(args[0], MessageRecoveryExample.class.getSimpleName() + "0", 0, 5000);
|
||||||
|
|
||||||
ConnectionFactory cf = new ActiveMQConnectionFactory();
|
ConnectionFactory cf = new ActiveMQConnectionFactory();
|
||||||
|
|
||||||
|
@ -66,7 +63,7 @@ public class QueueExample {
|
||||||
|
|
||||||
ServerUtil.killServer(server0);
|
ServerUtil.killServer(server0);
|
||||||
|
|
||||||
server0 = ServerUtil.startServer(args[0], QueueExample.class.getSimpleName() + "0", 0, 5000);
|
server0 = ServerUtil.startServer(args[0], MessageRecoveryExample.class.getSimpleName() + "0", 0, 5000);
|
||||||
|
|
||||||
ServerUtil.waitForServerToStart(0, 5000);
|
ServerUtil.waitForServerToStart(0, 5000);
|
||||||
|
|
|
@ -29,7 +29,7 @@ under the License.
|
||||||
|
|
||||||
<artifactId>queue-openwire</artifactId>
|
<artifactId>queue-openwire</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>ActiveMQ Artemis JMS Queue Example for openwire</name>
|
<name>ActiveMQ Artemis OpenWire JMS Queue Example</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
# JMS Queue Example for OpenWire
|
# OpenWire JMS Queue Example
|
||||||
|
|
||||||
To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify** if you want to start and create the broker manually.
|
To run the example, simply type **mvn verify** from this directory, or **mvn -PnoServer verify** if you want to start and create the broker manually.
|
||||||
|
|
||||||
This example shows you how to send and receive a message to a JMS Queue using ActiveMQ Artemis.
|
This example shows you how to send and receive a message to a JMS queue using ActiveMQ Artemis.
|
||||||
|
|
||||||
This example does exactly the same as the "queue" example however using the OpenWire client.
|
This example does exactly the same as the "queue" example however using the OpenWire client.
|
||||||
|
|
||||||
Queues are a standard part of JMS, please consult the JMS 1.1 specification for full details.
|
Notice this example is using the default configuration.
|
||||||
|
|
||||||
A Queue is used to send messages point to point, from a producer to a consumer. The queue guarantees message ordering between these 2 points.
|
|
||||||
|
|
||||||
Notice this example is using pretty much a default stock configuration
|
|
|
@ -80,13 +80,10 @@ under the License.
|
||||||
<goal>runClient</goal>
|
<goal>runClient</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<clientClass>org.apache.activemq.artemis.jms.example.StompDualAuthenticationExample</clientClass>
|
|
||||||
<args>
|
<args>
|
||||||
<arg>${project.basedir}/target/server0/etc/client-side-keystore.jks</arg>
|
<arg>${project.build.outputDirectory}/activemq/server0/</arg>
|
||||||
<arg>secureexample</arg>
|
|
||||||
<arg>${project.basedir}/target/server0/etc/client-side-truststore.jks</arg>
|
|
||||||
<arg>secureexample</arg>
|
|
||||||
</args>
|
</args>
|
||||||
|
<clientClass>org.apache.activemq.artemis.jms.example.StompDualAuthenticationExample</clientClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
|
|
@ -42,17 +42,18 @@ public class StompDualAuthenticationExample {
|
||||||
private static final String END_OF_FRAME = "\u0000";
|
private static final String END_OF_FRAME = "\u0000";
|
||||||
|
|
||||||
public static void main(final String[] args) throws Exception {
|
public static void main(final String[] args) throws Exception {
|
||||||
// set up SSL keystores for Stomp connection
|
|
||||||
System.setProperty("javax.net.ssl.keyStore", args[0]);
|
|
||||||
System.setProperty("javax.net.ssl.keyStorePassword", args[1]);
|
|
||||||
System.setProperty("javax.net.ssl.trustStore", args[2]);
|
|
||||||
System.setProperty("javax.net.ssl.trustStorePassword", args[3]);
|
|
||||||
|
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
InitialContext initialContext = null;
|
InitialContext initialContext = null;
|
||||||
Security.addProvider(new Provider());
|
Security.addProvider(new Provider());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// set up SSL keystores for Stomp connection
|
||||||
|
System.setProperty("javax.net.ssl.trustStore", args[0] + "client-side-truststore.jks");
|
||||||
|
System.setProperty("javax.net.ssl.trustStorePassword", "secureexample");
|
||||||
|
System.setProperty("javax.net.ssl.keyStore", args[0] + "client-side-keystore.jks");
|
||||||
|
System.setProperty("javax.net.ssl.keyStorePassword", "secureexample");
|
||||||
|
|
||||||
// Step 1. Create an SSL socket to connect to the broker
|
// Step 1. Create an SSL socket to connect to the broker
|
||||||
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
|
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
|
||||||
SSLSocket socket = (SSLSocket) sslsocketfactory.createSocket("localhost", 5500);
|
SSLSocket socket = (SSLSocket) sslsocketfactory.createSocket("localhost", 5500);
|
||||||
|
@ -114,6 +115,11 @@ public class StompDualAuthenticationExample {
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
connection.close();
|
connection.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.clearProperty("javax.net.ssl.trustStore");
|
||||||
|
System.clearProperty("javax.net.ssl.trustStorePassword");
|
||||||
|
System.clearProperty("javax.net.ssl.keyStore");
|
||||||
|
System.clearProperty("javax.net.ssl.keyStorePassword");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ under the License.
|
||||||
<!-- Acceptors -->
|
<!-- Acceptors -->
|
||||||
<acceptors>
|
<acceptors>
|
||||||
<acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
|
<acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
|
||||||
<acceptor name="netty-ssl-acceptor">tcp://localhost:5500?sslEnabled=true;needClientAuth=true;keyStorePath=${data.dir}/../etc/server-side-keystore.jks;keyStorePassword=secureexample;trustStorePath=${data.dir}/../etc/server-side-truststore.jks;trustStorePassword=secureexample</acceptor>
|
<acceptor name="netty-ssl-acceptor">tcp://localhost:5500?sslEnabled=true;needClientAuth=true;keyStorePath=server-side-keystore.jks;keyStorePassword=secureexample;trustStorePath=server-side-truststore.jks;trustStorePassword=secureexample</acceptor>
|
||||||
</acceptors>
|
</acceptors>
|
||||||
|
|
||||||
<!-- Other config -->
|
<!-- Other config -->
|
||||||
|
@ -47,7 +47,7 @@ under the License.
|
||||||
<addresses>
|
<addresses>
|
||||||
<address name="exampleQueue">
|
<address name="exampleQueue">
|
||||||
<anycast>
|
<anycast>
|
||||||
<queue name="jms.queue.exampleQueue"/>
|
<queue name="exampleQueue"/>
|
||||||
</anycast>
|
</anycast>
|
||||||
</address>
|
</address>
|
||||||
</addresses>
|
</addresses>
|
||||||
|
|
|
@ -29,7 +29,7 @@ under the License.
|
||||||
|
|
||||||
<artifactId>stomp-jms</artifactId>
|
<artifactId>stomp-jms</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>ActiveMQ Artemis JMS Stomp JMS Example</name>
|
<name>ActiveMQ Artemis Stomp JMS Example</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class StompExample {
|
||||||
|
|
||||||
connection.start();
|
connection.start();
|
||||||
|
|
||||||
System.out.println("Waiting 20 seconds");
|
System.out.println("Waiting 10 seconds");
|
||||||
Thread.sleep(10000); // increase this and it will fail
|
Thread.sleep(10000); // increase this and it will fail
|
||||||
System.out.println("waited");
|
System.out.println("waited");
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you 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.
|
||||||
|
-->
|
||||||
|
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
|
||||||
|
<core xmlns="urn:activemq:core">
|
||||||
|
|
||||||
|
<bindings-directory>./data/messaging/bindings</bindings-directory>
|
||||||
|
|
||||||
|
<journal-directory>./data/messaging/journal</journal-directory>
|
||||||
|
|
||||||
|
<large-messages-directory>./data/messaging/largemessages</large-messages-directory>
|
||||||
|
|
||||||
|
<paging-directory>./data/messaging/paging</paging-directory>
|
||||||
|
|
||||||
|
<acceptors>
|
||||||
|
<acceptor name="netty-acceptor">tcp://localhost:61616?anycastPrefix=/queue/</acceptor>
|
||||||
|
</acceptors>
|
||||||
|
|
||||||
|
<security-settings>
|
||||||
|
<security-setting match="#">
|
||||||
|
<permission roles="guest" type="consume"/>
|
||||||
|
<permission roles="guest" type="send"/>
|
||||||
|
<permission roles="guest" type="createAddress"/>
|
||||||
|
<permission roles="guest" type="createDurableQueue"/>
|
||||||
|
</security-setting>
|
||||||
|
</security-settings>
|
||||||
|
</core>
|
||||||
|
</configuration>
|
|
@ -46,8 +46,6 @@ public class StompExample {
|
||||||
|
|
||||||
// Step 2. Send a CONNECT frame to connect to the server
|
// Step 2. Send a CONNECT frame to connect to the server
|
||||||
String connectFrame = "CONNECT\n" +
|
String connectFrame = "CONNECT\n" +
|
||||||
"login: guest\n" +
|
|
||||||
"passcode: guest\n" +
|
|
||||||
"request-id: 1\n" +
|
"request-id: 1\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
END_OF_FRAME;
|
END_OF_FRAME;
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you 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.
|
||||||
|
-->
|
||||||
|
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
|
||||||
|
<core xmlns="urn:activemq:core">
|
||||||
|
|
||||||
|
<bindings-directory>./data/messaging/bindings</bindings-directory>
|
||||||
|
|
||||||
|
<journal-directory>./data/messaging/journal</journal-directory>
|
||||||
|
|
||||||
|
<large-messages-directory>./data/messaging/largemessages</large-messages-directory>
|
||||||
|
|
||||||
|
<paging-directory>./data/messaging/paging</paging-directory>
|
||||||
|
|
||||||
|
<acceptors>
|
||||||
|
<acceptor name="netty-acceptor">tcp://localhost:61616?protocols=CORE</acceptor>
|
||||||
|
<acceptor name="stomp-acceptor">tcp://localhost:61613?protocols=STOMP</acceptor>
|
||||||
|
</acceptors>
|
||||||
|
|
||||||
|
<security-settings>
|
||||||
|
<security-setting match="#">
|
||||||
|
<permission type="send" roles="guest"/>
|
||||||
|
<permission type="consume" roles="guest"/>
|
||||||
|
<permission type="createAddress" roles="guest"/>
|
||||||
|
<permission type="createDurableQueue" roles="guest"/>
|
||||||
|
</security-setting>
|
||||||
|
</security-settings>
|
||||||
|
|
||||||
|
<address-settings>
|
||||||
|
<address-setting match="#">
|
||||||
|
<default-address-routing-type>ANYCAST</default-address-routing-type>
|
||||||
|
<default-queue-routing-type>ANYCAST</default-queue-routing-type>
|
||||||
|
</address-setting>
|
||||||
|
</address-settings>
|
||||||
|
|
||||||
|
</core>
|
||||||
|
</configuration>
|
|
@ -48,8 +48,6 @@ public class StompExample {
|
||||||
String connectFrame = "CONNECT\n" +
|
String connectFrame = "CONNECT\n" +
|
||||||
"accept-version:1.1\n" +
|
"accept-version:1.1\n" +
|
||||||
"host:localhost\n" +
|
"host:localhost\n" +
|
||||||
"login:guest\n" +
|
|
||||||
"passcode:guest\n" +
|
|
||||||
"request-id:1\n" +
|
"request-id:1\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
END_OF_FRAME;
|
END_OF_FRAME;
|
||||||
|
@ -63,6 +61,7 @@ public class StompExample {
|
||||||
String text = "Hello World from Stomp 1.1 !";
|
String text = "Hello World from Stomp 1.1 !";
|
||||||
String message = "SEND\n" +
|
String message = "SEND\n" +
|
||||||
"destination:exampleQueue\n" +
|
"destination:exampleQueue\n" +
|
||||||
|
"destination-type:ANYCAST\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
text +
|
text +
|
||||||
END_OF_FRAME;
|
END_OF_FRAME;
|
||||||
|
|
|
@ -48,8 +48,6 @@ public class StompExample {
|
||||||
String connectFrame = "CONNECT\n" +
|
String connectFrame = "CONNECT\n" +
|
||||||
"accept-version:1.2\n" +
|
"accept-version:1.2\n" +
|
||||||
"host:localhost\n" +
|
"host:localhost\n" +
|
||||||
"login:guest\n" +
|
|
||||||
"passcode:guest\n" +
|
|
||||||
"request-id:1\n" +
|
"request-id:1\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
END_OF_FRAME;
|
END_OF_FRAME;
|
||||||
|
@ -63,6 +61,7 @@ public class StompExample {
|
||||||
String text = "Hello World from Stomp 1.2 !";
|
String text = "Hello World from Stomp 1.2 !";
|
||||||
String message = "SEND\n" +
|
String message = "SEND\n" +
|
||||||
"destination:exampleQueue\n" +
|
"destination:exampleQueue\n" +
|
||||||
|
"destination-type:ANYCAST\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
text +
|
text +
|
||||||
END_OF_FRAME;
|
END_OF_FRAME;
|
||||||
|
|
|
@ -256,10 +256,10 @@ public class AmqpClientTestSupport extends AmqpTestSupport {
|
||||||
// Configure roles
|
// Configure roles
|
||||||
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
|
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
|
||||||
HashSet<Role> value = new HashSet<>();
|
HashSet<Role> value = new HashSet<>();
|
||||||
value.add(new Role("nothing", false, false, false, false, false, false, false, false));
|
value.add(new Role("nothing", false, false, false, false, false, false, false, false, false, false));
|
||||||
value.add(new Role("browser", false, false, false, false, false, false, false, true));
|
value.add(new Role("browser", false, false, false, false, false, false, false, true, false, false));
|
||||||
value.add(new Role("guest", false, true, false, false, false, false, false, true));
|
value.add(new Role("guest", false, true, false, false, false, false, false, true, false, false));
|
||||||
value.add(new Role("full", true, true, true, true, true, true, true, true));
|
value.add(new Role("full", true, true, true, true, true, true, true, true, true, true));
|
||||||
securityRepository.addMatch(getQueueName(), value);
|
securityRepository.addMatch(getQueueName(), value);
|
||||||
|
|
||||||
server.getConfiguration().setSecurityEnabled(true);
|
server.getConfiguration().setSecurityEnabled(true);
|
||||||
|
|
|
@ -486,7 +486,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase {
|
||||||
//setup user and role on broker
|
//setup user and role on broker
|
||||||
((ActiveMQJAASSecurityManager) liveService.getSecurityManager()).getConfiguration().addUser("myUser", "myPassword");
|
((ActiveMQJAASSecurityManager) liveService.getSecurityManager()).getConfiguration().addUser("myUser", "myPassword");
|
||||||
((ActiveMQJAASSecurityManager) liveService.getSecurityManager()).getConfiguration().addRole("myUser", "consumeCreateRole");
|
((ActiveMQJAASSecurityManager) liveService.getSecurityManager()).getConfiguration().addRole("myUser", "consumeCreateRole");
|
||||||
Role consumeCreateRole = new Role("consumeCreateRole", false, true, true, true, true, true, true, true);
|
Role consumeCreateRole = new Role("consumeCreateRole", false, true, true, true, true, true, true, true, true, true);
|
||||||
Set<Role> consumerCreateRoles = new HashSet<>();
|
Set<Role> consumerCreateRoles = new HashSet<>();
|
||||||
consumerCreateRoles.add(consumeCreateRole);
|
consumerCreateRoles.add(consumeCreateRole);
|
||||||
liveService.getSecurityRepository().addMatch("test.queue", consumerCreateRoles);
|
liveService.getSecurityRepository().addMatch("test.queue", consumerCreateRoles);
|
||||||
|
|
|
@ -181,10 +181,10 @@ public class MQTTTestSupport extends ActiveMQTestBase {
|
||||||
// Configure roles
|
// Configure roles
|
||||||
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
|
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
|
||||||
HashSet<Role> value = new HashSet<>();
|
HashSet<Role> value = new HashSet<>();
|
||||||
value.add(new Role("nothing", false, false, false, false, false, false, false, false));
|
value.add(new Role("nothing", false, false, false, false, false, false, false, false, false, false));
|
||||||
value.add(new Role("browser", false, false, false, false, false, false, false, true));
|
value.add(new Role("browser", false, false, false, false, false, false, false, true, false, false));
|
||||||
value.add(new Role("guest", false, true, false, false, false, false, false, true));
|
value.add(new Role("guest", false, true, false, false, false, false, false, true, false, false));
|
||||||
value.add(new Role("full", true, true, true, true, true, true, true, true));
|
value.add(new Role("full", true, true, true, true, true, true, true, true, true, true));
|
||||||
securityRepository.addMatch(getQueueName(), value);
|
securityRepository.addMatch(getQueueName(), value);
|
||||||
|
|
||||||
server.getConfiguration().setSecurityEnabled(true);
|
server.getConfiguration().setSecurityEnabled(true);
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class OutgoingConnectionNoJTATest extends ActiveMQRATestBase {
|
||||||
((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
|
((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest");
|
||||||
((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("testuser", "arole");
|
((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("testuser", "arole");
|
||||||
((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "arole");
|
((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "arole");
|
||||||
Role role = new Role("arole", true, true, true, true, true, true, true, true);
|
Role role = new Role("arole", true, true, true, true, true, true, true, true, true, true);
|
||||||
Set<Role> roles = new HashSet<>();
|
Set<Role> roles = new HashSet<>();
|
||||||
roles.add(role);
|
roles.add(role);
|
||||||
server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles);
|
server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles);
|
||||||
|
|
|
@ -285,13 +285,11 @@ public class StompTest extends StompTestBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
public void sendMessageToNonExistentQueue(String queuePrefix, String queue, RoutingType routingType) throws Exception {
|
||||||
public void testSendMessageToNonExistentQueue() throws Exception {
|
|
||||||
String nonExistentQueue = RandomUtil.randomString();
|
|
||||||
conn.connect(defUser, defPass);
|
conn.connect(defUser, defPass);
|
||||||
send(conn, getQueuePrefix() + nonExistentQueue, null, "Hello World", true, RoutingType.ANYCAST);
|
send(conn, queuePrefix + queue, null, "Hello World", true, routingType);
|
||||||
|
|
||||||
MessageConsumer consumer = session.createConsumer(ActiveMQJMSClient.createQueue(nonExistentQueue));
|
MessageConsumer consumer = session.createConsumer(ActiveMQJMSClient.createQueue(queue));
|
||||||
TextMessage message = (TextMessage) consumer.receive(1000);
|
TextMessage message = (TextMessage) consumer.receive(1000);
|
||||||
Assert.assertNotNull(message);
|
Assert.assertNotNull(message);
|
||||||
Assert.assertEquals("Hello World", message.getText());
|
Assert.assertEquals("Hello World", message.getText());
|
||||||
|
@ -305,26 +303,32 @@ public class StompTest extends StompTestBase {
|
||||||
Assert.assertTrue(Math.abs(tnow - tmsg) < 1500);
|
Assert.assertTrue(Math.abs(tnow - tmsg) < 1500);
|
||||||
|
|
||||||
// closing the consumer here should trigger auto-deletion
|
// closing the consumer here should trigger auto-deletion
|
||||||
assertNotNull(server.getActiveMQServer()
|
assertNotNull(server.getActiveMQServer().getPostOffice().getBinding(new SimpleString(queue)));
|
||||||
.getPostOffice()
|
|
||||||
.getBinding(new SimpleString(nonExistentQueue)));
|
|
||||||
consumer.close();
|
consumer.close();
|
||||||
assertNull(server.getActiveMQServer()
|
assertNull(server.getActiveMQServer().getPostOffice().getBinding(new SimpleString(queue)));
|
||||||
.getPostOffice()
|
|
||||||
.getBinding(new SimpleString(nonExistentQueue)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSendMessageToNonExistentTopic() throws Exception {
|
public void testSendMessageToNonExistentQueue() throws Exception {
|
||||||
String nonExistentTopic = RandomUtil.randomString();
|
sendMessageToNonExistentQueue(getQueuePrefix(), RandomUtil.randomString(), RoutingType.ANYCAST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSendMessageToNonExistentQueueUsingExplicitDefaultRouting() throws Exception {
|
||||||
|
String nonExistentQueue = RandomUtil.randomString();
|
||||||
|
server.getActiveMQServer().getAddressSettingsRepository().addMatch(nonExistentQueue, new AddressSettings().setDefaultAddressRoutingType(RoutingType.ANYCAST).setDefaultQueueRoutingType(RoutingType.ANYCAST));
|
||||||
|
sendMessageToNonExistentQueue(getQueuePrefix(), nonExistentQueue, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendMessageToNonExistentTopic(String topicPrefix, String topic, RoutingType routingType) throws Exception {
|
||||||
conn.connect(defUser, defPass);
|
conn.connect(defUser, defPass);
|
||||||
|
|
||||||
// first send a message to ensure that sending to a non-existent topic won't throw an error
|
// first send a message to ensure that sending to a non-existent topic won't throw an error
|
||||||
send(conn, getTopicPrefix() + nonExistentTopic, null, "Hello World", true, RoutingType.MULTICAST);
|
send(conn, topicPrefix + topic, null, "Hello World", true, routingType);
|
||||||
|
|
||||||
// create a subscription on the topic and send/receive another message
|
// create a subscription on the topic and send/receive another message
|
||||||
MessageConsumer consumer = session.createConsumer(ActiveMQJMSClient.createTopic(nonExistentTopic));
|
MessageConsumer consumer = session.createConsumer(ActiveMQJMSClient.createTopic(topic));
|
||||||
send(conn, getTopicPrefix() + nonExistentTopic, null, "Hello World", true);
|
send(conn, topicPrefix + topic, null, "Hello World", true, routingType);
|
||||||
TextMessage message = (TextMessage) consumer.receive(1000);
|
TextMessage message = (TextMessage) consumer.receive(1000);
|
||||||
Assert.assertNotNull(message);
|
Assert.assertNotNull(message);
|
||||||
Assert.assertEquals("Hello World", message.getText());
|
Assert.assertEquals("Hello World", message.getText());
|
||||||
|
@ -337,14 +341,29 @@ public class StompTest extends StompTestBase {
|
||||||
long tmsg = message.getJMSTimestamp();
|
long tmsg = message.getJMSTimestamp();
|
||||||
Assert.assertTrue(Math.abs(tnow - tmsg) < 1500);
|
Assert.assertTrue(Math.abs(tnow - tmsg) < 1500);
|
||||||
|
|
||||||
assertNotNull(server.getActiveMQServer()
|
assertNotNull(server.getActiveMQServer().getAddressInfo(new SimpleString(topic)));
|
||||||
.getAddressInfo(new SimpleString(nonExistentTopic)));
|
|
||||||
|
|
||||||
// closing the consumer here should trigger auto-deletion of the subscription queue and address
|
// closing the consumer here should trigger auto-deletion of the subscription queue and address
|
||||||
consumer.close();
|
consumer.close();
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
assertNull(server.getActiveMQServer()
|
assertNull(server.getActiveMQServer().getAddressInfo(new SimpleString(topic)));
|
||||||
.getAddressInfo(new SimpleString(nonExistentTopic)));
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSendMessageToNonExistentTopic() throws Exception {
|
||||||
|
sendMessageToNonExistentTopic(getTopicPrefix(), RandomUtil.randomString(), RoutingType.MULTICAST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSendMessageToNonExistentTopicUsingExplicitDefaultRouting() throws Exception {
|
||||||
|
String nonExistentTopic = RandomUtil.randomString();
|
||||||
|
server.getActiveMQServer().getAddressSettingsRepository().addMatch(nonExistentTopic, new AddressSettings().setDefaultAddressRoutingType(RoutingType.MULTICAST).setDefaultQueueRoutingType(RoutingType.MULTICAST));
|
||||||
|
sendMessageToNonExistentTopic(getTopicPrefix(), nonExistentTopic, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSendMessageToNonExistentTopicUsingImplicitDefaultRouting() throws Exception {
|
||||||
|
sendMessageToNonExistentTopic(getTopicPrefix(), RandomUtil.randomString(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -37,6 +37,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||||
import org.apache.activemq.artemis.core.config.Configuration;
|
import org.apache.activemq.artemis.core.config.Configuration;
|
||||||
import org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolManagerFactory;
|
import org.apache.activemq.artemis.core.protocol.mqtt.MQTTProtocolManagerFactory;
|
||||||
|
@ -50,7 +51,6 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
|
||||||
import org.apache.activemq.artemis.core.security.Role;
|
import org.apache.activemq.artemis.core.security.Role;
|
||||||
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
import org.apache.activemq.artemis.core.server.ActiveMQServer;
|
||||||
import org.apache.activemq.artemis.core.server.ActiveMQServers;
|
import org.apache.activemq.artemis.core.server.ActiveMQServers;
|
||||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
|
||||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
|
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
|
||||||
import org.apache.activemq.artemis.jms.server.JMSServerManager;
|
import org.apache.activemq.artemis.jms.server.JMSServerManager;
|
||||||
|
@ -65,6 +65,7 @@ import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame
|
||||||
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
|
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
|
||||||
import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
|
import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
|
||||||
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
|
@ -159,6 +160,15 @@ public abstract class StompTestBase extends ActiveMQTestBase {
|
||||||
connection.start();
|
connection.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
if (connection != null) {
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.activemq.artemis.tests.integration.stomp;
|
package org.apache.activemq.artemis.tests.integration.stomp;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.activemq.artemis.api.core.Interceptor;
|
import org.apache.activemq.artemis.api.core.Interceptor;
|
||||||
|
@ -25,7 +26,6 @@ import org.apache.activemq.artemis.core.protocol.core.Packet;
|
||||||
import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
|
import org.apache.activemq.artemis.core.protocol.stomp.StompFrame;
|
||||||
import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor;
|
import org.apache.activemq.artemis.core.protocol.stomp.StompFrameInterceptor;
|
||||||
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
|
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
|
||||||
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
|
|
||||||
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
|
import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame;
|
||||||
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
|
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
|
||||||
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
|
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
|
||||||
|
@ -38,8 +38,8 @@ public class StompWithInterceptorsTest extends StompTestBase {
|
||||||
@Override
|
@Override
|
||||||
public List<String> getIncomingInterceptors() {
|
public List<String> getIncomingInterceptors() {
|
||||||
List<String> stompIncomingInterceptor = new ArrayList<>();
|
List<String> stompIncomingInterceptor = new ArrayList<>();
|
||||||
stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompWithInterceptorsTest$MyIncomingStompFrameInterceptor");
|
stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompWithInterceptorsTest$IncomingStompInterceptor");
|
||||||
stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompWithInterceptorsTest$MyCoreInterceptor");
|
stompIncomingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompWithInterceptorsTest$CoreInterceptor");
|
||||||
|
|
||||||
return stompIncomingInterceptor;
|
return stompIncomingInterceptor;
|
||||||
}
|
}
|
||||||
|
@ -47,20 +47,25 @@ public class StompWithInterceptorsTest extends StompTestBase {
|
||||||
@Override
|
@Override
|
||||||
public List<String> getOutgoingInterceptors() {
|
public List<String> getOutgoingInterceptors() {
|
||||||
List<String> stompOutgoingInterceptor = new ArrayList<>();
|
List<String> stompOutgoingInterceptor = new ArrayList<>();
|
||||||
stompOutgoingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompWithInterceptorsTest$MyOutgoingStompFrameInterceptor");
|
stompOutgoingInterceptor.add("org.apache.activemq.artemis.tests.integration.stomp.StompWithInterceptorsTest$OutgoingStompInterceptor");
|
||||||
|
|
||||||
return stompOutgoingInterceptor;
|
return stompOutgoingInterceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void stompFrameInterceptor() throws Exception {
|
public void stompFrameInterceptor() throws Exception {
|
||||||
MyIncomingStompFrameInterceptor.incomingInterceptedFrames.clear();
|
IncomingStompInterceptor.interceptedFrames.clear();
|
||||||
MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.clear();
|
OutgoingStompInterceptor.interceptedFrames.clear();
|
||||||
|
// wait for the SESS_START which is the last packet for the test's JMS connection
|
||||||
Thread.sleep(200);
|
assertTrue(Wait.waitFor(() -> {
|
||||||
|
for (Packet packet : new ArrayList<>(CoreInterceptor.incomingInterceptedFrames)) {
|
||||||
// So we clear them here
|
if (packet.getType() == (byte) 67) {
|
||||||
MyCoreInterceptor.incomingInterceptedFrames.clear();
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}, 2000, 50));
|
||||||
|
CoreInterceptor.incomingInterceptedFrames.clear();
|
||||||
|
|
||||||
StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
|
StompClientConnection conn = StompClientConnectionFactory.createClientConnection(uri);
|
||||||
conn.connect(defUser, defPass);
|
conn.connect(defUser, defPass);
|
||||||
|
@ -71,11 +76,11 @@ public class StompWithInterceptorsTest extends StompTestBase {
|
||||||
subFrame.addHeader("ack", "auto");
|
subFrame.addHeader("ack", "auto");
|
||||||
conn.sendFrame(subFrame);
|
conn.sendFrame(subFrame);
|
||||||
|
|
||||||
assertEquals(0, MyCoreInterceptor.incomingInterceptedFrames.size());
|
assertEquals(0, CoreInterceptor.incomingInterceptedFrames.size());
|
||||||
sendJmsMessage(getName());
|
sendJmsMessage(getName());
|
||||||
|
|
||||||
// Something was supposed to be called on sendMessages
|
// Something was supposed to be called on sendMessages
|
||||||
assertTrue("core interceptor is not working", MyCoreInterceptor.incomingInterceptedFrames.size() > 0);
|
assertTrue("core interceptor is not working", CoreInterceptor.incomingInterceptedFrames.size() > 0);
|
||||||
|
|
||||||
conn.receiveFrame(10000);
|
conn.receiveFrame(10000);
|
||||||
|
|
||||||
|
@ -84,81 +89,66 @@ public class StompWithInterceptorsTest extends StompTestBase {
|
||||||
frame.setBody("Hello World");
|
frame.setBody("Hello World");
|
||||||
conn.sendFrame(frame);
|
conn.sendFrame(frame);
|
||||||
|
|
||||||
|
assertTrue(Wait.waitFor(() -> OutgoingStompInterceptor.interceptedFrames.size() == 3, 2000, 50));
|
||||||
|
|
||||||
conn.disconnect();
|
conn.disconnect();
|
||||||
|
|
||||||
|
assertTrue(Wait.waitFor(() -> IncomingStompInterceptor.interceptedFrames.size() == 4, 2000, 50));
|
||||||
|
|
||||||
List<String> incomingCommands = new ArrayList<>(4);
|
List<String> incomingCommands = new ArrayList<>(4);
|
||||||
incomingCommands.add("CONNECT");
|
incomingCommands.add("CONNECT");
|
||||||
incomingCommands.add("SUBSCRIBE");
|
incomingCommands.add("SUBSCRIBE");
|
||||||
incomingCommands.add("SEND");
|
incomingCommands.add("SEND");
|
||||||
incomingCommands.add("DISCONNECT");
|
incomingCommands.add("DISCONNECT");
|
||||||
|
|
||||||
|
for (int i = 0; i < IncomingStompInterceptor.interceptedFrames.size(); i++) {
|
||||||
|
Assert.assertEquals(incomingCommands.get(i), IncomingStompInterceptor.interceptedFrames.get(i).getCommand());
|
||||||
|
Assert.assertEquals("incomingInterceptedVal", IncomingStompInterceptor.interceptedFrames.get(i).getHeader("incomingInterceptedProp"));
|
||||||
|
}
|
||||||
|
|
||||||
List<String> outgoingCommands = new ArrayList<>(3);
|
List<String> outgoingCommands = new ArrayList<>(3);
|
||||||
outgoingCommands.add("CONNECTED");
|
outgoingCommands.add("CONNECTED");
|
||||||
outgoingCommands.add("MESSAGE");
|
outgoingCommands.add("MESSAGE");
|
||||||
outgoingCommands.add("MESSAGE");
|
outgoingCommands.add("MESSAGE");
|
||||||
|
|
||||||
long timeout = System.currentTimeMillis() + 1000;
|
for (int i = 0; i < OutgoingStompInterceptor.interceptedFrames.size(); i++) {
|
||||||
|
Assert.assertEquals(outgoingCommands.get(i), OutgoingStompInterceptor.interceptedFrames.get(i).getCommand());
|
||||||
// Things are async, giving some time to things arrive before we actually assert
|
|
||||||
while (MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size() < 4 &&
|
|
||||||
MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size() < 3 &&
|
|
||||||
timeout > System.currentTimeMillis()) {
|
|
||||||
Thread.sleep(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Wait.waitFor(() -> {
|
Assert.assertEquals("incomingInterceptedVal", OutgoingStompInterceptor.interceptedFrames.get(2).getHeader("incomingInterceptedProp"));
|
||||||
return MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size() == 4;
|
Assert.assertEquals("outgoingInterceptedVal", OutgoingStompInterceptor.interceptedFrames.get(2).getHeader("outgoingInterceptedProp"));
|
||||||
});
|
|
||||||
Assert.assertEquals(4, MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size());
|
|
||||||
Wait.waitFor(() -> {
|
|
||||||
return MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size() == 3;
|
|
||||||
});
|
|
||||||
Assert.assertEquals(3, MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size());
|
|
||||||
|
|
||||||
for (int i = 0; i < MyIncomingStompFrameInterceptor.incomingInterceptedFrames.size(); i++) {
|
|
||||||
Assert.assertEquals(incomingCommands.get(i), MyIncomingStompFrameInterceptor.incomingInterceptedFrames.get(i).getCommand());
|
|
||||||
Assert.assertEquals("incomingInterceptedVal", MyIncomingStompFrameInterceptor.incomingInterceptedFrames.get(i).getHeader("incomingInterceptedProp"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.size(); i++) {
|
public static class CoreInterceptor implements Interceptor {
|
||||||
Assert.assertEquals(outgoingCommands.get(i), MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.get(i).getCommand());
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.assertEquals("incomingInterceptedVal", MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.get(2).getHeader("incomingInterceptedProp"));
|
|
||||||
Assert.assertEquals("outgoingInterceptedVal", MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.get(2).getHeader("outgoingInterceptedProp"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class MyCoreInterceptor implements Interceptor {
|
|
||||||
|
|
||||||
static List<Packet> incomingInterceptedFrames = new ArrayList<>();
|
static List<Packet> incomingInterceptedFrames = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean intercept(Packet packet, RemotingConnection connection) {
|
public boolean intercept(Packet packet, RemotingConnection connection) {
|
||||||
IntegrationTestLogger.LOGGER.info("Core intercepted: " + packet);
|
|
||||||
incomingInterceptedFrames.add(packet);
|
incomingInterceptedFrames.add(packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MyIncomingStompFrameInterceptor implements StompFrameInterceptor {
|
public static class IncomingStompInterceptor implements StompFrameInterceptor {
|
||||||
|
|
||||||
static List<StompFrame> incomingInterceptedFrames = new ArrayList<>();
|
static List<StompFrame> interceptedFrames = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
|
public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
|
||||||
incomingInterceptedFrames.add(stompFrame);
|
interceptedFrames.add(stompFrame);
|
||||||
stompFrame.addHeader("incomingInterceptedProp", "incomingInterceptedVal");
|
stompFrame.addHeader("incomingInterceptedProp", "incomingInterceptedVal");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MyOutgoingStompFrameInterceptor implements StompFrameInterceptor {
|
public static class OutgoingStompInterceptor implements StompFrameInterceptor {
|
||||||
|
|
||||||
static List<StompFrame> outgoingInterceptedFrames = new ArrayList<>();
|
static List<StompFrame> interceptedFrames = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
|
public boolean intercept(StompFrame stompFrame, RemotingConnection connection) {
|
||||||
outgoingInterceptedFrames.add(stompFrame);
|
interceptedFrames.add(stompFrame);
|
||||||
stompFrame.addHeader("outgoingInterceptedProp", "outgoingInterceptedVal");
|
stompFrame.addHeader("outgoingInterceptedProp", "outgoingInterceptedVal");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
|
|
||||||
<security-settings>
|
<security-settings>
|
||||||
<security-setting match="#">
|
<security-setting match="#">
|
||||||
|
<permission type="createAddress" roles="guest,def"/>
|
||||||
|
<permission type="deleteAddress" roles="guest,def"/>
|
||||||
<permission type="createDurableQueue" roles="guest,def"/>
|
<permission type="createDurableQueue" roles="guest,def"/>
|
||||||
<permission type="deleteDurableQueue" roles="guest,def"/>
|
<permission type="deleteDurableQueue" roles="guest,def"/>
|
||||||
<permission type="createNonDurableQueue" roles="guest,def"/>
|
<permission type="createNonDurableQueue" roles="guest,def"/>
|
||||||
|
|
Loading…
Reference in New Issue