Contact Free trial Login

Storing Objects in the Registry

If you need to store runtime data that is available across the application, you can store the data as objects in the Registry. You can get a handle to the Registry from anywhere that you have access to the MuleContext, as in most Mule entities. For example, you could store the object as follows:

muleContext.getRegistry().registerObject("foo", new MyFoo());

You could then update the object from somewhere else:

Foo foo = (Foo) muleContext.getRegistry().lookupObject("foo");
// Replace the previous object
muleContext.getRegistry().registerObject("foo", foo);

This approach is useful for storing an object that is needed by multiple components across your application.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.