final ServiceName hqServiceName = MessagingServices.getHornetQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
ServiceController<?> hqService = registry.getService(hqServiceName);
if (hqService != null) {
context.reloadRequired();
} else {
final ServiceTarget target = context.getServiceTarget();
if(model.hasDefined(CommonAttributes.SOCKET_BINDING.getName())) {
final GroupBindingService bindingService = new GroupBindingService();
target.addService(GroupBindingService.getDiscoveryBaseServiceName(hqServiceName).append(name), bindingService)
.addDependency(SocketBinding.JBOSS_BINDING_NAME.append(model.get(SOCKET_BINDING).asString()), SocketBinding.class, bindingService.getBindingRef())
.install();
} else {
final ModelNode localAddrNode = CommonAttributes.LOCAL_BIND_ADDRESS.resolveModelAttribute(context, model);
final String localAddress = localAddrNode.isDefined() ? localAddrNode.asString() : null;
final String groupAddress = CommonAttributes.GROUP_ADDRESS.resolveModelAttribute(context, model).asString();
final int groupPort = CommonAttributes.GROUP_PORT.resolveModelAttribute(context, model).asInt();
try {
final InetAddress inet = localAddress != null ? InetAddress.getByName(localAddress) : InetAddressUtil.getLocalHost();
final NetworkInterface intf = NetworkInterface.getByInetAddress(inet);
final NetworkInterfaceBinding b = new NetworkInterfaceBinding(Collections.singleton(intf), inet);
final InetAddress group = InetAddress.getByName(groupAddress);
final SocketBinding socketBinding = new SocketBinding(name, -1, false, group, groupPort, b, null, null);
final GroupBindingService bindingService = new GroupBindingService();
target.addService(GroupBindingService.getDiscoveryBaseServiceName(hqServiceName).append(name), bindingService)
.addInjectionValue(bindingService.getBindingRef(), new ImmediateValue<SocketBinding>(socketBinding))
.install();
} catch (Exception e) {
throw new OperationFailedException(new ModelNode().set(e.getLocalizedMessage()));