MSMQ Implementation in SSIS
HI All,
I have never used MSMQ task before so having problem to use it.
I have table which holds messages and for reconcilation of those messages in table I need to send those messages to Meesage queue ,I have filtered messages using conditional split in package but dont know how to send messages from output of conditional split
to Message queue.
As I have 2 columns to send to queue ,
Table Message Queue
MessageID Lable
XMLMessage MeesageBody
Any suggestion will be appereciated.
Thanks in advance!
CPatil
MCTS 2008 & 2005 , MCITP 2008 -- Please remember to mark the post as answered if it answers your question.
June 15th, 2011 1:27pm
Use this post http://sqlserverrider.wordpress.com/2011/06/08/sendreceive-messages-from-msmq-%E2%80%93-ssis/ as a starting pointArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
June 15th, 2011 1:30pm
Thank You ArthurZ!
But still I'm stuck in a problem.
I am sending messages on remote server. using Script Component in SSIS package.
Here is code
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System.Messaging;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
public override void PreExecute()
{
base.PreExecute();
/*
Add your code here for preprocessing or remove if not needed
*/
}
public override void PostExecute()
{
base.PostExecute();
/*
Add your code here for postprocessing or remove if not needed
You can set read/write variables here, for example:
Variables.MyIntVar = 100
*/
}
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
/*
Add your code here .\private$\STNAuditMain
*/
if (Row != null)
{
try
{
MessageQueue msgQ = new MessageQueue("\\servername\\Private$\\test");
msgQ.SetPermissions("EVERYONE", MessageQueueAccessRights.FullControl);
object obj = (object)Row.XMLMessage;
msgQ.Send(obj);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
When I replace servername by localserver or "." it works perfectly fine but I'm trying to send on remote server it gives me error as "INVALID QUEUE PATH"
Integration services has logon as "Domain User" which has Administrative aceess on remote server.
Using SQL Server 2008
Windows server 2003 enterprise.
Am I missing some thigng to get connect with remote server?
Please suggest me get this problem solved.
Thanks!
CPatil
MCTS 2008 & 2005 , MCITP 2008 -- Please remember to mark the post as answered if it answers your question.
June 29th, 2011 2:10pm
Hello Cpatil
I recall I also got confused at the beginning with the path to the MSMQ, but it is not too hard to fix it, seems to me if you could first skim through this article it could help:
http://blogs.msdn.com/b/johnbreakwell/archive/2009/02/26/difference-between-path-name-and-format-name-when-accessing-msmq-queues.aspx
Since you used "\\servername\\Private$\\test" try by IP like
DIRECT=TCP:157.34.104.22\MyQueue
PS: I hope you have access to Active Directory
Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2011 3:54pm