---
title: Best Practices for Custom BizTalk Pipeline Components – Reliable DTA Logging and Performance
description: Ensure reliable DTA Logging and maximize BizTalk performance by building custom pipeline components with best practices. Learn how to use ResourceTracker for robust, efficient integrations with Nodinite.
---

# About Custom BizTalk Pipeline Components

Unlock the full potential of your BizTalk Server integrations by following best practices for custom pipeline components. On this page, you will:

* ✅ Ensure reliable DTA Logging and seamless monitoring with <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span>  
* ✅ Prevent resource leaks and maximize BizTalk performance  
* ✅ Build robust, high-performance custom pipeline components with confidence  
* ✅ Learn how to use ResourceTracker for efficient resource management

<aside aria-label="Important" class="nodinite-note nodinite-note--important">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-message-exclamation"></i> Important</p>
<div class="nodinite-note__content"><p>If you do not build custom pipeline components according to the best practices outlined on this page, DTA Logging will not operate. Make sure your developers follow these guidelines to achieve reliable logging and monitoring.</p></div>
</aside>

When you develop custom BizTalk pipeline components with best practices, you manage resources efficiently within the BizTalk Server environment. By leveraging the `ResourceTracker`, you deliver robust, reliable, and high-performance integrations that scale with your business needs.  

## Why Following Best Practices Matters

* **Automatic Resource Cleanup**  
  BizTalk Server uses the `ResourceTracker` to track disposable resources such as streams, file handles, or database connections. When you add your `stream` to the `ResourceTracker`, the BizTalk runtime disposes of it at the right time and prevents resource leaks.  

* **Efficient Memory Management**  
  BizTalk processes large volumes of messages. If you handle resources improperly, you can cause memory leaks, degrade performance, or even crash your system. By following best practices, you ensure BizTalk releases resources promptly and maintains optimal performance.  

* **Supports Streaming Model**  
  BizTalk pipelines handle large messages by streaming rather than loading them entirely into memory. The `ResourceTracker` keeps streams available as long as needed and cleans them up after use, so you can process messages efficiently and at scale.  

* **Best Practice for Custom Components**  
  Always use `ResourceTracker.AddResource` for any stream-based transformations or processing in your custom pipeline components. This approach aligns with BizTalk’s built-in behavior and ensures reliability.  

## Example Scenario

Suppose you create a custom pipeline component that modifies an incoming stream. If you do not add it to `ResourceTracker`, BizTalk might not release it properly, which leads to resource leaks and potentially lost tracking.  

### Example Usage in a Custom Component

```csharp
public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
{
    Stream originalStream = pInMsg.BodyPart.GetOriginalDataStream();
    Stream transformedStream = new CustomStreamWrapper(originalStream); 

    // Add the new stream to the ResourceTracker to ensure it's properly managed
    pContext.ResourceTracker.AddResource(transformedStream);

    pInMsg.BodyPart.Data = transformedStream;
    return pInMsg;
}
```

## Conclusion

When you use `pContext.ResourceTracker.AddResource(stream);`, you empower BizTalk to manage resources efficiently. This results in better performance, stability, and reliability for your custom pipeline components.  

If the built-in DTA Tracking does not operate, <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> will not operate either.  

---

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

* <i class="fal fa-question-circle" aria-hidden="true"></i> [Troubleshooting][]  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-hard-drive" aria-hidden="true"></i> [BizTalk Logging Overview][BizTalkOverview]  
* <i class="fal fa-exchange-alt" aria-hidden="true"></i> [BAM Replacement][BAMReplacement]  

[BAMReplacement]:https://docs.nodinite.com/logging-and-monitoring/microsoft-biztalk-server-logging/features/bam-replacement/
[BizTalkOverview]:https://docs.nodinite.com/logging-and-monitoring/microsoft-biztalk-server-logging/overview/
[Troubleshooting]:https://docs.nodinite.com/logging-and-monitoring/microsoft-biztalk-server-logging/troubleshooting/uninstall/