Skip to content

Commit

Permalink
[WFLY-5667] Migration: do not migrate parameters ignored by new subsy…
Browse files Browse the repository at this point in the history
…stem

During migration, do not migrate the use-nio parameter for remote/http
connector/acceptor resources in the new messaging-activemq subsystem and
add a warnings to the :migrate operation result.

JIRA: https://issues.jboss.org/browse/WFLY-5667
  • Loading branch information
jmesnil committed Nov 19, 2015
1 parent dcf554c commit 07abb65
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,11 @@ private void transformResources(OperationContext context, final ModelNode legacy
if (name.equals("http-upgrade-endpoint") && address.getParent().getLastElement().getKey().equals("http-connector")) {
parentAddOp.get("endpoint").set(value);
} else {
parentAddOp.get("params").add(new Property(name, value));
if (parameterIsAllowed(name, resourceType)) {
parentAddOp.get("params").add(new Property(name, value));
} else {
warnings.add(ROOT_LOGGER.couldNotMigrateIgnoredParameter(name, address.getParent()));
}
}
continue;
}
Expand All @@ -441,6 +445,28 @@ private void transformResources(OperationContext context, final ModelNode legacy
}
}

/**
* Check if the name of the parameter is allowed for the given resourceType.
*/
private boolean parameterIsAllowed(String name, String resourceType) {
switch (resourceType) {
case REMOTE_ACCEPTOR:
case HTTP_ACCEPTOR:
case REMOTE_CONNECTOR:
case HTTP_CONNECTOR:
// WFLY-5667 - for now remove only use-nio. Revisit this code when Artemis offers an API
// to know which parameters are ignored.
if ("use-nio".equals(name)) {
return false;
} else {
return true;
}
default:
// accept any parameter for other resources.
return true;
}
}

private boolean connectionFactoryIsUsingInVMConnectors(OperationContext context, ModelNode connectionFactoryAddOp) {
ModelNode connector = connectionFactoryAddOp.get(CONNECTOR);
if (connector.isDefined()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -823,4 +823,7 @@ public interface MessagingLogger extends BasicLogger {

@Message(id = 86, value = "Could not migrate attribute %s from resource %s. The attribute uses an expression that can be resolved differently depending on system properties. To be able to migrate this property, replace the expression by an actual value.")
String couldNotMigrateResourceAttributeWithExpression(String attribute, PathAddress address);

@Message(id = 87, value = "Could not migrate parameter %s from resource %s. This parameter is ignored in the new messaging-activemq subsystem.")
String couldNotMigrateIgnoredParameter(String attribute, PathAddress address);
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ private void testMigrateOperation(boolean addLegacyEntries) throws Exception {
// 2 warnings about interceptors that can not be migrated.
// 1 warning about HA migration (attributes have expressions)
// 1 warning about cluster-connection forward-when-no-consumers attribute having an expression.
int expectedNumberOfWarnings = 6 + 2 + 5 + 2 + 2 + 1 + 1;
// 1 warning about use-nio being ignored for netty-throughput remote-connector resource.
int expectedNumberOfWarnings = 6 + 2 + 5 + 2 + 2 + 1 + 1 + 1;
// 1 warning if add-legacy-entries is true because an in-vm connector can not be used in a legacy-connection-factory
if (addLegacyEntries) {
expectedNumberOfWarnings += 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<netty-connector name="netty" socket-binding="messaging" />
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="${batch.delay:50}"/>
<param key="use-nio" value="true"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="${my.server-id:0}" />
<connector name="myconnector">
Expand Down

0 comments on commit 07abb65

Please sign in to comment.