DLL has the same code as the script task(sending message to MSMQ)
Stored Procedure Syntax:
create PROCEDURE [dbo].[prcSendMSMQMessage]
@msmqPath varchar(255),
@messageBody varchar(1000)
AS
DECLARE @msmqQueue INT
DECLARE @result INT
-- Create the SQLMSMQ Object.
EXECUTE @result = sp_OACreate 'SqlMSMQ.SqlMsmq', @msmqQueue OUT, 1
IF @result <> 0 GOTO ErrorHandler
-- Send the message using the Send method
EXECUTE @result = sp_OAMethod @msmqQueue, 'SendMessage', NULL, @msmqPath, @messageBody
IF @result <> 0 GOTO ErrorHandler
GOTO DestroyObjects
ErrorHandler:
DECLARE @source varchar(53)
DECLARE @description VARCHAR(200)
EXECUTE sp_OAGetErrorInfo @msmqQueue, @source OUT, @description OUT, NULL, NULL
RAISERROR(@description, 16, 1)
GOTO DestroyObjects
DestroyObjects:
-- Destroy the SQLMSMQ object.
EXECUTE @result = sp_OADestroy @msmqQueue
RETURN
Promblem:
This step
EXECUTE @result = sp_OACreate 'SqlMSMQ.SqlMsmq', @msmqQueue OUT, 1
gives result as -2146234334 which fails