The Huong Dan Java Logger only uses the Logging Framework to log information that the user needs to log. The default category of Anypoint Devkit (Connectors) is unreasonable. Therefore, I will use the annotation @Category of Mule ESB to adjust. You can refer to the annotation @Category in this tutorial.
Here, in the categories that Mule supports, I find it most logical to be the Components category. Do you have any other opinions? 🙂
I will open the HuongDanJavaLoggerComponentConnector class to add the @Category annotation after the @Connector annotation as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
package com.huongdanjava.hdjlogger; import org.mule.api.annotations.Category; import org.mule.api.annotations.Config; import org.mule.api.annotations.Connector; import org.mule.api.annotations.Processor; import com.huongdanjava.hdjlogger.config.ConnectorConfig; @Connector(name="huong-dan-java-logger-component", friendlyName="Huong Dan Java Logger") @Category(name = "org.mule.tooling.category.core", description = "Components") public class HuongDanJavaLoggerComponentConnector { @Config ConnectorConfig config; /** * Custom processor * * @param friend Name to be used to generate a greeting message. * @return A greeting message */ @Processor public String greet(String friend) { /* * MESSAGE PROCESSOR CODE GOES HERE */ return config.getGreeting() + " " + friend + ". " + config.getReply(); } public ConnectorConfig getConfig() { return config; } public void setConfig(ConnectorConfig config) { this.config = config; } } |
At this point, if you install our Connector (by right-clicking on the project, selecting Anypoint Connector and selecting Install or Update), you will see in the Mule Palette, the Components part, the Huong Dan Java Logger appears as follows ( You have to open a file Mule Configuration File to see Mule Palette):