Archive

Posts Tagged ‘fuse’

How to add files to a Fuse 6.1 profile using the CLI

July 15, 2015 2 comments

For some mysterious reason its not possible to upload a file to a profile in Fuse 6.1. Since we tend to script the complete creation and deployment of our Fuse environments we needed to be able to add files to profiles from a script.

The support guys gave me this script that adds a function called ‘import-resource’, and since it really helped us I though I’d share it with the internet:

# Imports resources (ex. xml or properties) into a Fabric Profile
# ex.
# import-resource "TestProfile" "1.0" "something.xml" "/home/jsensharma/Downloads"
# profile-display --display-resources TestProfile

import-resource = {
 
    _profile = $1
    _version = $2
    _logical_file_path = $3
    _physical_file_path = $4
     
    _file_content = ((cat file://$_physical_file_path) | tac)
     
    _sref = $.context getServiceReference "io.fabric8.api.FabricService"
    _srv = $.context getService $_sref
    _dstore = $_srv getdatastore
     
    $_dstore setFileConfiguration $_version $_profile $_logical_file_path ($_file_content getbytes)
     
}

After running this script you’ll be able to upload files like this:

import-resource test-profile 1.0 resource.data /tmp/resource.data
Advertisements
Categories: JBoss Fuse Tags: ,

Remote Debug on Fuse Fabric Container

January 27, 2015 Leave a comment

When you create a container in fabric you can specify which options should be passed to the container. This way you can set the amount of memory for instance, but you can also specify that the container should start in debug modus.

The following Fuse CLI command would create a container with a maximum heap size of 256 MB:

container-create-child --jvm-opts "-Xmx256m" root child

In the Hawt.io console you’ll find the “Jvm opts” option under the “Advanced” tab on the container creation page.

Now you can also use this to pass the regular debug commands to a JVM: “-Xdebug -Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=n”.

The CLI command would then look like this:

container-create-child --jvm-opts "-Xdebug -Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=n" root child

The suspend=n part means that the JVM won’t wait for a debugger to connect but will startup like usual. If you need to see what happens in the JVM right after it starts you can change this to suspend=y. The JVM will then block until a debugger is connected.

This post is based on my answer to luca.santaniello.81 on the JBoss Developer forums.

Categories: JBoss Fuse Tags: , , , , ,